Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gizmo: support cleanup #186

Closed
unional opened this issue Apr 24, 2023 · 0 comments
Closed

gizmo: support cleanup #186

unional opened this issue Apr 24, 2023 · 0 comments

Comments

@unional
Copy link
Owner

unional commented Apr 24, 2023

justland/just-web#21

const gizmo = define({
  async create() {
    return [{}, () => () => 'clean up']
  }
})

How to trigger? This will be breaking change:

const [app, cleanup] = await incubate().with(...).create()

cleanup()

One solution is to use symbol:

const app = await incubate().with(...).create()

await cleanup(app)

async function cleanup(app) {
  app[destructorSymbol]()
}

or use the same pattern:

const app = await incubate().with(...).create(() => () => clean up)

This design conflict with #161.
Need to find to way to make both of them work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant