Last Updated: February 25, 2016
·
4.086K
· netzzwerg

RequireJS with jQuery Deferred

moduleA.js

define(['require', 'jquery'], function (require, $) {
    "use strict";

    var deferred = $.Deferred();

    require(['moduleB'],function(moduleB){
        deferred.resolve(moduleB);
    });

    return deferred.promise();

});

app.js

require(['moduleA'],function(deferred){
    deferred.done(function(moduleA) {
        console.log(moduleA);
    });
});

1 Response
Add your response

This. Is awesome.

over 1 year ago ·