Created
July 2, 2025 19:02
-
-
Save thelinuxlich/166017bec84da9d7658fcbf2800366b4 to your computer and use it in GitHub Desktop.
Revisions
-
thelinuxlich created this gist
Jul 2, 2025 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ class LazyPromise extends Promise { constructor(executor) { super(executor); if (typeof executor !== 'function') { throw new TypeError(`executor is not a function`); } this._executor = executor; } then() { this.promise = this.promise || new Promise(this._executor); return this.promise.then.apply(this.promise, arguments); } }