Last active
September 25, 2023 12:58
-
-
Save Amatewasu/608506d3640a2086227b2c8d154613f4 to your computer and use it in GitHub Desktop.
log all promises
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const allPromises = []; | |
class Promise2 extends Promise { | |
constructor(executor: (resolve, reject) => Promise2) { | |
super((resolve, reject) => { | |
return executor(resolve, reject); | |
}); | |
allPromises.push(this); | |
} | |
} | |
(window ).Promise = Promise2; | |
(window).showAllPromises = () => { | |
console.log(allPromises); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const allPromises: Promise<any>[] = []; | |
class Promise2<T> extends Promise<T> { | |
constructor(executor: (resolve: any, reject: any) => Promise2<T>) { | |
super((resolve, reject) => { | |
return executor(resolve, reject); | |
}); | |
allPromises.push(this); | |
} | |
} | |
(window as any).Promise = Promise2; | |
(window as any).showAllPromises = () => { | |
console.log(allPromises); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment