Skip to content

Commit

Permalink
$mol_wire_sync fix restartable task getter
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkalica committed Nov 4, 2024
1 parent 21e056e commit 5277bb0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions wire/sync/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,28 @@ namespace $ {

let val = (obj as any)[ field ]
if( typeof val !== 'function' ) return val

const temp = $mol_wire_task.getter(val)

return new Proxy( val, {
apply( target, self, args ) {
return $mol_wire_task.get(target, obj, args ).sync()
return temp( obj, args ).sync()
},
construct(target, args) {
const constr = $mol_wire_sync_factory(target)
return $mol_wire_task.get(constr , obj, args ).sync() as object
const temp = $mol_wire_task.getter($mol_wire_sync_factory(target))
return temp( obj, args ).sync() as object
},

})
},

construct(obj, args) {
const constr = $mol_wire_sync_factory(obj as new ( ... args: unknown[] )=> unknown)
return $mol_wire_task.get( constr , obj, args ).sync() as object
const temp = $mol_wire_task.getter($mol_wire_sync_factory(obj as new ( ... args: unknown[] )=> unknown))
return temp( obj, args ).sync() as object
},

apply( obj, self, args ) {
return $mol_wire_task.get(obj as ( ... args: any[] )=> any, self, args).sync()
const temp = $mol_wire_task.getter(obj as ( ... args: any[] )=> any)
return temp(self, args).sync()
},

} ) as unknown as ObjectOrFunctionResultAwaited<Host>
Expand Down

0 comments on commit 5277bb0

Please sign in to comment.