0.0.1 • Published 11 years ago
nce-amd v0.0.1
AMD extension for NCE
Description
This is an nce extension for Asynchronous Module Definition support designed with require.js.
How to install
Install with npm: npm install --save nce-amd
Integrate in NCE with the extension-manager:
var NCE = require("nce");
var nce = new NCE(/*{}*/);
var extMgr = require("nce-extension-manager")(nce);
var amd = extMgr.getActivatedExtension("amd");How to use
Config settings
You are able to use the following config-settings with their defaults:
route: "/amd": Sub-URL to listendumpPath: process.cwd() + "/amd": Directory to dump fileslogger: {}: Settings for logger-extension
Basic methods
ext.define(name, code, cb, opts)
Define a module for amd.
Normally the code get minified. If you don't want to, set: opts.minify = false.
Arguments
nameString: A name as identifiercodeString: JavaScript code, written in amd-style.cbFunction: Callback-function formfs.writeFilewith the arguments:errorError: Used for exceptions
optsObject: Options:minifyBoolean: Minify code (default true)
ext.defineCDN(name, url, cb)
Define a module from cdn.
Arguments
nameString: A name as identifierurlString: URL to JS-Resource.cbFunction: Callback-function formfs.writeFilewith the arguments:
ext.get = function(name, cb)
Get the content of a resource as buffer.
Arguments
ext.getStream = function(name)
Get a stream of a resource.
Arguments
nameString: A name as identifier
Returns a stream from fs.createReadStream.
ext.undefine = function(name, cb)
Remove a script from defined functions by its name.
Arguments
nameString: A name as identifiercbFunction: Callback-function formfs.readFilewith the arguments:errorError: Used for exceptions
ext.mkScriptTag = function(mainName)
Returns a html-script-tag with mainName as start script for amd.
Arguments
mainNameString: A name as identifier
Returns a HTML-script tag with require.js and loads mainName with its dependencies.
0.0.1
11 years ago