@grafana/runtime
Version:
Grafana Runtime Library
17 lines (15 loc) • 566 B
JavaScript
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