Skip to content

Commit

Permalink
chore: upgrade to grumbler-scripts v5
Browse files Browse the repository at this point in the history
  • Loading branch information
westeezy committed Feb 21, 2022
1 parent 95ae0d8 commit bb83cb3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@commitlint/cli": "^16.2.1",
"@commitlint/config-conventional": "^16.2.1",
"flow-bin": "0.155.0",
"grumbler-scripts": "^3",
"grumbler-scripts": "^5.0.3",
"husky": "^7.0.4",
"mocha": "^4",
"standard-version": "^9.3.2"
Expand Down
25 changes: 13 additions & 12 deletions src/promise.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
/* @flow */
/* eslint no-use-before-define: off */

import { isPromise } from './utils';
import { onPossiblyUnhandledException, dispatchPossiblyUnhandledError } from './exceptions';
import { startActive, endActive, awaitActive } from './flush';

export class ZalgoPromise<R : mixed> {

resolved : boolean
rejected : boolean
errorHandled : boolean
value : R
error : mixed
resolved : boolean;
rejected : boolean;
errorHandled : boolean;
value : R;
error : mixed;
// eslint-disable-next-line flowtype/no-mutable-array
handlers : Array<{|
promise : ZalgoPromise<*>,
onSuccess : void | (result : R) => mixed,
onError : void | (error : mixed) => mixed
|}>
dispatching : boolean
stack : string
|}>;
dispatching : boolean;
stack : string;

constructor(handler : ?(resolve : (result : R) => void, reject : (error : mixed) => void) => void) {

Expand Down Expand Up @@ -135,7 +136,7 @@ export class ZalgoPromise<R : mixed> {
this.reject(error);
return this;
}

dispatch() {

const { dispatching, resolved, rejected, handlers } = this;
Expand Down Expand Up @@ -340,7 +341,7 @@ export class ZalgoPromise<R : mixed> {

const promise = new ZalgoPromise();
let count = promises.length;
// eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef, unicorn/prefer-spread
const results = ([] : $TupleMap<X, <Y>(ZalgoPromise<Y> | Y) => Y>).slice();

if (!count) {
Expand Down Expand Up @@ -402,7 +403,7 @@ export class ZalgoPromise<R : mixed> {
}
}
}

return ZalgoPromise.all(awaitPromises).then(() => result);
}

Expand All @@ -424,7 +425,7 @@ export class ZalgoPromise<R : mixed> {
let result : ZalgoPromise<X> | Y;

startActive();

try {
result = method.apply(context, args || []);
} catch (err) {
Expand Down

0 comments on commit bb83cb3

Please sign in to comment.