UNPKG

@grafana/runtime

Version:
17 lines (15 loc) 566 B
let singleton; function setPluginComponentHook(hook) { if (singleton && process.env.NODE_ENV !== "test") { throw new Error("setPluginComponentHook() function should only be called once, when Grafana is starting."); } singleton = hook; } function usePluginComponent(componentId) { if (!singleton) { throw new Error("setPluginComponentHook(options) can only be used after the Grafana instance has started."); } return singleton(componentId); } export { setPluginComponentHook, usePluginComponent }; //# sourceMappingURL=usePluginComponent.mjs.map