Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @episerver/amd-loader-proxy with all npm packages installed. Try it out:

var amdLoaderProxy = require("@episerver/amd-loader-proxy")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@episerver/amd-loader-proxy v1.0.0

A proxy to the AMD require function used in Episerver

amd-loader-proxy

A proxy to the AMD require function used in Episerver.

Installation

yarn

yarn add @episerver/amd-loader-proxy

npm

npm install @episerver/amd-loader-proxy

Importing

import loader from "@episerver/amd-loader-proxy";

Usage

The @episerver/amd-loader-proxy package exports a single function that takes the module ids as string parameters and returns a promise. This promise will resolve to an array containing the results for each module, e.g.:

// Load a single AMD module.
loader("dojo/topic").then(([topic]) => {

});

// Load multiple AMD modules.
loader("dojo/topic", "epi-cms/plugin-area/navigation-tree").then(([topic, navigationTreePluginArea]) => {

});

Or if you are using async/await:

const foo = async () => {
    // Load a single AMD module.
    const [topic] = await loader("dojo/topic");

    // Load multiple AMD modules.
    const [topic, navigationTreePluginArea] = await loader("dojo/topic", "epi-cms/plugin-area/navigation-tree");
}

License

MIT © Episerver

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free