Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dfeda57

Browse files
committed
UPDATE
1 parent c09bed6 commit dfeda57

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

‎JS/JS-br.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -870,15 +870,15 @@ MyPromise.prototype.then = function(onResolved, onRejected) {
870870
let promise2;
871871
// especificação 2.2, ambos `onResolved` e `onRejected` são argumentos opcionais
872872
// isso deveria ser ignorado se `onResolved` ou `onRjected` não for uma função,
873-
// which implements the penetrate pass of it's value
873+
// do qual implementa a penetrar a passagem desse valor
874874
// `Promise.resolve(4).then().then((value) => console.log(value))`
875875
onResolved = typeof onResolved === 'function' ? onResolved : v => v;
876876
onRejected = typeof onRejected === 'function' ? onRejected : r => throw r;
877877

878878
if (self.currentState === RESOLVED) {
879879
return (promise2 = new MyPromise((resolve, reject) => {
880-
// specification 2.2.4, wrap them with `setTimeout`,
881-
// in order to insure that `onFulfilled` and `onRjected` execute asynchronously
880+
// especificação 2.2.4, encapsula eles com `setTimeout`,
881+
// em ordem para garantir que `onFulfilled` e `onRjected` executam assícronamente
882882
setTimeout(() => {
883883
try {
884884
let x = onResolved(self.value);
@@ -892,7 +892,7 @@ MyPromise.prototype.then = function(onResolved, onRejected) {
892892

893893
if (self.currentState === REJECTED) {
894894
return (promise2 = new MyPromise((resolve, reject) => {
895-
// execute `onRejected` asynchronously
895+
// execute `onRejected` assícronamente
896896
setTimeout(() => {
897897
try {
898898
let x = onRejected(self.value);
@@ -907,7 +907,7 @@ MyPromise.prototype.then = function(onResolved, onRejected) {
907907
if (self.currentState === PENDING) {
908908
return (promise2 = new MyPromise((resolve, reject) => {
909909
self.resolvedCallbacks.push(() => {
910-
// Considering that it may throw error, wrap them with `try/catch`
910+
// Considerando que isso deve lançar um erro, encapsule eles com `try/catch`
911911
try {
912912
let x = onResolved(self.value);
913913
resolutionProcedure(promise2, x, resolve, reject);
@@ -928,22 +928,22 @@ MyPromise.prototype.then = function(onResolved, onRejected) {
928928
}
929929
}
930930

931-
// specification 2.3
931+
// especificação 2.3
932932
function resolutionProcedure(promise2, x, resolve, reject) {
933-
// specification 2.3.1,`x` and `promise2` can't refer to the same object,
934-
// avoiding the circular references
933+
// especificação 2.3.1,`x` e `promise2` não podem ser referenciados para o mesmo objeto,
934+
// evitando referência circular
935935
if (promise2 === x) {
936936
return reject(new TypeError('Error'));
937937
}
938938

939-
// specification 2.3.2, if `x` is a Promise and the state is `pending`,
940-
// the promise must remain, If not, it should execute.
939+
// especificação 2.3.2, se `x` é uma Promise e o estado é `pending`,
940+
// a promisse deve permanecer, se não, ele deve ser executado.
941941
if (x instanceof MyPromise) {
942942
if (x.currentState === PENDING) {
943-
// call the function `resolutionProcedure` again to
944-
// confirm the type of the argument that x resolves
945-
// If it's a primitive type, it will be resolved again to
946-
// pass the value to next `then`.
943+
// chame a função `resolutionProcedure` novamente para
944+
// confirmar o tipo de argumento que x resolve
945+
// Se for um tipo primitivo, irá ser resolvido novamente
946+
// passando o valor para o próximo `then`.
947947
x.then((value) => {
948948
resolutionProcedure(promise2, value, resolve, reject);
949949
}, reject)
@@ -953,9 +953,9 @@ function resolutionProcedure(promise2, x, resolve, reject) {
953953
return;
954954
}
955955

956-
// specification 2.3.3.3.3
957-
// if both `reject` and `resolve` are executed, the first successful
958-
// execution takes precedence, and any further executions are ignored
956+
// especificação 2.3.3.3.3
957+
// se ambos `reject` e `resolve` forem executado, a primeira execução
958+
// de sucesso tem precedência, e qualquer execução é ignorada
959959
let called = false;
960960
// specification 2.3.3, determine whether `x` is an object or a function
961961
if (x !== null && (typeof x === 'object' || typeof x === 'function')) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /