Options
All
  • Public
  • Public/Protected
  • All
Menu

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);
    });
});

Hierarchy

  • PluginResourceLoader

Index

Constructors

constructor

Methods

addRawStyleSheet

  • addRawStyleSheet(styleSheet: string): void
  • Creates a