UNPKG

@grafana/runtime

Version:
18 lines (16 loc) 580 B
"use strict"; 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