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

feat: add setup function for spec #6122

Merged
merged 4 commits into from
Jan 26, 2024

Conversation

Saul-Mirone
Copy link
Collaborator

const DocPageSpec: BlockSpec<DocPageBlockWidgetName, DocPageService> = {
  schema: PageBlockSchema,
  service: DocPageService,
  view: {
    /* ... */
  },
  setup: (slots, disposables) => {
    disposables.add(slots.mounted.on(onMounted));
    disposables.add(slots.viewConnected.on(onViewConnected));
    disposables.add(slots.widgetConnected.on(onWidgetConnected));
  }
}

Copy link

vercel bot commented Jan 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blocksuite ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 26, 2024 2:10am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
blocksuite-docs ⬜️ Ignored (Inspect) Visit Preview Jan 26, 2024 2:10am

Copy link
Member

@doodlewind doodlewind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess the docs/guide/block-spec docs could also be updated.

And wondering for block-specific setup logic, what' the best practice to distinguish between using the service.mount and spec.setup?

@doodlewind doodlewind added the doc-needed Major features that requires documentation label Jan 26, 2024
@Saul-Mirone
Copy link
Collaborator Author

Guess the docs/guide/block-spec docs could also be updated.

And wondering for block-specific setup logic, what' the best practice to distinguish between using the service.mount and spec.setup?

  1. I'll add the doc in next pr.
  2. The setup can be configured when you try use a spec, the service.mount method is used to define a spec.

Copy link
Member

@doodlewind doodlewind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀🚀🚀

@doodlewind doodlewind merged commit 8f1922d into toeverything:master Jan 26, 2024
19 checks passed
@Saul-Mirone Saul-Mirone deleted the spec-setup-function branch January 26, 2024 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-needed Major features that requires documentation notable Major improvement worth emphasizing
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants