@mxy_c/g-promise
v1.1.0
Published
create promise with no callback,g
Downloads
12
Maintainers
Readme
createPromise
example
- ts
import { createPromise } from '@mxy_c/g-promise';
const { promise, resolve, reject } = createPromise<number>();
promise.then(
val => {
console.log('resole');
console.log(val);
},
reason => {
console.log('reject');
console.log(reason);
}
);
resolve(1);
- js
import { createPromise } from '@mxy_c/g-promise';
const { promise, resolve, reject } = createPromise(0);
promise.then(
val => {
console.log('resole');
console.log(val);
},
reason => {
console.log('reject');
console.log(reason);
}
);
resolve(22);