Skip to content

Commit

Permalink
Merge pull request #721 from hyoo-ru/promise-destructor
Browse files Browse the repository at this point in the history
$mol_wire_fiber, promise destructor
  • Loading branch information
zerkalica authored Dec 5, 2024
2 parents 3391a6c + 0fb1aaa commit 1e3065e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion wire/fiber/fiber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ namespace $ {
* Asynchronous execution.
* It's SuspenseAPI consumer. So SuspenseAPI providers can be called inside.
*/
async async() {
async async_raw() {

while( true ) {

Expand All @@ -287,6 +287,14 @@ namespace $ {
}

}

async() {
const promise = this.async_raw() as Promise<Result> & { destructor(): void }

if (! promise.destructor) promise.destructor = () => this.destructor()

return promise
}

step() {
return new Promise< null >( done => {
Expand Down

0 comments on commit 1e3065e

Please sign in to comment.