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);
});
});
Written by Béla Varga
Related protips
1 Response
This. Is awesome.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Related Tags
#javascript
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#