Used to asynchronously load plugin resources.
Example (TypeScript):
import {PluginResourceLoader} from "PluginApi/PluginResourceLoader"; declare let pluginData: PluginGlobalLoadingData; let loader = new PluginResourceLoader(pluginData); loader.loadResources(["main.min.css", "main.html"], (resources) => { if( resources["main.min.css"].data ) loader.addRawStyleSheet(resources["main.min.css"].data); if( resources["main.html"].data ) $(document.body).append(resources["main.html"].data); });
Example (JavaScript):
require(["PluginApi/PluginResourceLoader"], function(PluginResourceLoaderModule) { var loader = new PluginResourceLoaderModule.PluginResourceLoader(pluginData); loader.loadResources(["main.min.css", "main.html"], function(resources) => { if( resources["main.min.css"].data ) loader.addRawStyleSheet(resources["main.min.css"].data); if( resources["main.html"].data ) $(document.body).append(resources["main.html"].data); }); });
Constructs resource loader from plugin ID or pluginData object available in plugins scope.
See PluginResourceLoader class description for an example.
Creates a
Used to asynchronously load plugin resources.
Example (TypeScript):
import {PluginResourceLoader} from "PluginApi/PluginResourceLoader"; declare let pluginData: PluginGlobalLoadingData; let loader = new PluginResourceLoader(pluginData); loader.loadResources(["main.min.css", "main.html"], (resources) => { if( resources["main.min.css"].data ) loader.addRawStyleSheet(resources["main.min.css"].data); if( resources["main.html"].data ) $(document.body).append(resources["main.html"].data); });
Example (JavaScript):
require(["PluginApi/PluginResourceLoader"], function(PluginResourceLoaderModule) { var loader = new PluginResourceLoaderModule.PluginResourceLoader(pluginData); loader.loadResources(["main.min.css", "main.html"], function(resources) => { if( resources["main.min.css"].data ) loader.addRawStyleSheet(resources["main.min.css"].data); if( resources["main.html"].data ) $(document.body).append(resources["main.html"].data); }); });