0.14.5 • Published 7 years ago

ima-plugin-script-loader v0.14.5

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

ima-plugin-script-loader

This is the plugin for loading 3rd party scripts for the IMA.js application. You can find the IMA.js skeleton application at https://github.com/seznam/IMA.js-skeleton or follow link https://imajs.io.

Installation

npm install ima-plugin-script-loader --save
// /app/build.js

var vendors = {
	common: [
		'ima-plugin-script-loader'
	]
};

/*
Now is script loader plugin available as:

import { ScriptLoaderPlugin, events, defaultDependencies } from 'ima-plugin-script-loader';
*/

Usage

import Dispatcher from 'ima/event/Dispatcher';
import { ScriptLoaderPlugin, events as ScriptLoaderEvents } from 'ima-plugin-script-loader';

oc
	.get(ScriptLoaderPlugin)
	.load('//www.example.com/script.js')
	.then((result) => {
		console.log('Script is loaded.', result.url);
	})
	.catch((error) => {
		console.log('Script failed to load.', error);
	});

oc
	.get(Dispatcher)
	.listen(ScriptLoaderEvents.LOADED, (result) => {
		if (result.error) {
			console.log('Script is not loaded.', result.url);
		} else {
			console.log('Script is loaded.', result.url);
		}
	});
0.14.5

7 years ago

0.14.4

7 years ago

0.14.3

7 years ago

0.14.2

8 years ago

0.14.1

8 years ago

0.14.0

8 years ago

0.13.0

8 years ago

0.12.1

8 years ago

0.12.0

8 years ago