Skip to content

Instantly share code, notes, and snippets.

@Amatewasu
Last active September 25, 2023 12:58
Show Gist options
  • Save Amatewasu/608506d3640a2086227b2c8d154613f4 to your computer and use it in GitHub Desktop.
Save Amatewasu/608506d3640a2086227b2c8d154613f4 to your computer and use it in GitHub Desktop.
log all promises
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);
};
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