MCPcopy
hub / github.com/nukeop/nuclear / register

Function register

packages/player/src/services/providersHost.ts:55–71  ·  view source on GitHub ↗
(provider: T)

Source from the content-addressed store, hash-verified

53
54 return {
55 register<T extends ProviderDescriptor>(provider: T): string {
56 const kindMap = byKind.get(provider.kind) ?? new Map();
57 kindMap.set(provider.id, provider);
58 byKind.set(provider.kind, kindMap);
59 byId.set(provider.id, provider);
60
61 const store = useProvidersStore.getState();
62 // Activate the first registered provider if no selection is persisted.
63 // A persisted id that isn't registered yet is preserved: the matching
64 // provider may still register later.
65 if (!store.getActive(provider.kind)) {
66 store.setActive(provider.kind, provider.id);
67 }
68
69 notify();
70 return provider.id;
71 },
72
73 unregister(providerId: string): boolean {
74 const current = byId.get(providerId);

Callers

nothing calls this directly

Calls 4

notifyFunction · 0.85
getStateMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected