Documentation Menu

AMD

jsnlog.js has the necessary code to function as an AMD module.

Creating a dependency on JSNLog is no different than doing so on any other module. For example, here is a file with dependencies on jQuery and JSNLog:

require(["jquery", "jsnlog"], function ($, JL) {
    $(function () {
        JL().info('DOM loaded');
    })
});

One problem with this page is that it loads jsnlog.js, which is not minified. If you'd rather load the minified version jsnlog.min.js, you could specify a dependency on that instead:

require(["jquery", "jsnlog.min"], function ($, JL) {
    $(function () {
        JL().info('DOM loaded');
    })
});

Alternatively, if you use require.config in your main module, you can add a line to associate the jsnlog module ID with the minified file:

require.config({
    baseUrl: 'Scripts',
    paths: {
        jquery: 'jquery-1.11.0.min',
        jsnlog: 'jsnlog.min'
    }
});
require(["jquery", "jsnlog"], function ($, JL) {
    $(function () {
        JL().info('DOM loaded');
    })
});