()
| 17 | } |
| 18 | |
| 19 | function captureSync() { |
| 20 | const fiber = Fiber.getCurrent() |
| 21 | const instance = fiber ? Context.getReferenceUnsafe(fiber.context, InstanceRef) : undefined |
| 22 | const workspace = |
| 23 | (fiber ? Context.getReferenceUnsafe(fiber.context, WorkspaceRef) : undefined) ?? WorkspaceContext.workspaceID |
| 24 | return { instance, workspace } |
| 25 | } |
| 26 | |
| 27 | export const bind = <Args extends readonly unknown[], Result>(fn: (...args: Args) => Result) => { |
| 28 | const captured = captureSync() |