i develop application , modules it. modules include requirejs, want include in applications has not requirejs support.
how need modify library file let included in other js file (by copying content)?
so want library have both ways of use:
requirejs(["helper/util"], function(util) { // library loaded window.myutilmodule = util; window.myutilmodule.somefunc(); });
and
/* >> no requrejs library load here << */ /* >> code copied 'helper/util.js' goes here << */ window.myutilmodule.somefunc(); // loaded simple including code file
read umd. typical umd header looks like:
(function (factory) { if (typeof exports === 'object') { module.exports = factory(require('backbone'), require('underscore')); } else if (typeof define === 'function' && define.amd) { define(['backbone', 'underscore'], factory); } }(function (backbone, _) { // code }));
Comments
Post a Comment