Skip to content

Commit

Permalink
$mol_wire_fiber, promise destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkalica committed Dec 5, 2024
1 parent 3391a6c commit 0fb1aaa
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 0fb1aaa

Please sign in to comment.