Skip to content

Commit 4a11875

Browse files
committed
Finished Promise
1 parent dfeda57 commit 4a11875

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

JS/JS-br.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -957,27 +957,27 @@ function resolutionProcedure(promise2, x, resolve, reject) {
957957
// se ambos `reject` e `resolve` forem executado, a primeira execução
958958
// de sucesso tem precedência, e qualquer execução é ignorada
959959
let called = false;
960-
// specification 2.3.3, determine whether `x` is an object or a function
960+
// especificação 2.3.3, determina se `x` é um objeto ou uma função
961961
if (x !== null && (typeof x === 'object' || typeof x === 'function')) {
962-
// specification 2.3.3.2, if can't get `then`, execute the `reject`
962+
// especificação 2.3.3.2, se não conseguir obter o `then`, execute o `reject`
963963
try {
964-
// specification 2.3.3.1
964+
// especificação 2.3.3.1
965965
let then = x.then;
966-
// if `then` is a function, call the `x.then`
966+
// se `then` é uma função, chame o `x.then`
967967
if (typeof then === 'function') {
968-
// specification 2.3.3.3
968+
// especificação 2.3.3.3
969969
then.call(x, y => {
970970
if (called) return;
971971
called = true;
972-
// specification 2.3.3.3.1
972+
// especificação 2.3.3.3.1
973973
resolutionProcedure(promise2, y, resolve, reject);
974974
}, e => {
975975
if (called) return;
976976
called = true;
977977
reject(e);
978978
});
979979
} else {
980-
// specification 2.3.3.4
980+
// especificação 2.3.3.4
981981
resolve(x);
982982
}
983983
} catch (e) {
@@ -986,13 +986,13 @@ function resolutionProcedure(promise2, x, resolve, reject) {
986986
reject(e);
987987
}
988988
} else {
989-
// specification 2.3.4, `x` belongs to primitive data type
989+
// especificação 2.3.4, `x` pertence ao tipo primitivo de dados
990990
resolve(x);
991991
}
992992
}
993993
```
994994
995-
The above codes, which is implemented based on the Promise / A+ specification, can pass the full test of `promises-aplus-tests`
995+
O código acima, que é implementado baseado em Promise / A+ especificação, pode passar os testes completos de `promises-aplus-tests`
996996
997997
![](https://user-gold-cdn.xitu.io/2018/3/29/162715e8e37e689d?w=1164&h=636&f=png&s=300285)
998998

0 commit comments

Comments
 (0)