Skip to content

Commit

Permalink
avoid other js change the Promise
Browse files Browse the repository at this point in the history
  • Loading branch information
Keillion committed Dec 24, 2024
1 parent 70ea0b8 commit 4d9476f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mutable-promise",
"version": "1.1.14",
"version": "1.1.15",
"description": "Wrapper for Promise. Resolvable, rejectable, redirectable.",
"files": [
"/dist",
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ type Reject = (reason?: any) => void;
type Executor<T> = (resolve: Resolve<T>, reject: Reject) => void;

const isPromiseLike = (value:any) => (value && "object" === typeof value && "function" === typeof value.then);

// get original `Promise`, avoid other js change the `Promise`
const Promise = (async()=>{})().constructor as PromiseConstructor;
class MutablePromise<T> extends Promise<T>{

private _s: string;
Expand Down

0 comments on commit 4d9476f

Please sign in to comment.