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

Support registering graphs #188

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Support registering graphs #188

wants to merge 3 commits into from

Conversation

guyca
Copy link
Collaborator

@guyca guyca commented Oct 28, 2024

This PR adds a new API that will allow decoupling injection targets from graphs.

API

Registering a graph

Registering a graph will let you use it by its registered key.

Obsidian.registerGraph('FooGraph', () => require('some/path/FooGraph).default);

injectHook

Inject your target with the key used to register the graph.

export const FooHook = injectHook(useFoo, 'FooGraph');

Obsidian.obtain

Registered graphs can still be used as service locators.

import type FooGraph from 'some/path/FooGraph';

Obsidian.obtain<FooGraph>('FooGraph').foo();

Tasks

  • obtain registered graphs
  • inject hooks
  • inject components
  • registered subgraphs
  • documentation

@guyca guyca marked this pull request as draft October 28, 2024 19:05
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

Successfully merging this pull request may close these issues.

1 participant