Skip to content

Instantly share code, notes, and snippets.

@eduardo-matos
Last active December 15, 2015 02:49
Show Gist options
  • Save eduardo-matos/5190377 to your computer and use it in GitHub Desktop.
Save eduardo-matos/5190377 to your computer and use it in GitHub Desktop.
load-css module in Dojo
define([
'dojo/on',
'dojo/_base/window',
'dojo/dom-construct',
'dojo/Deferred'
], function (
on,
win,
domConstruct,
Deferred
) {
'use strict';
function loadCss (url) {
var deferred = new Deferred();
var link = domConstruct.create('link', {
rel: 'stylesheet',
type: 'text/css',
href: url
}, win.body());
on(link, 'load', function () {
deferred.resolve();
});
return deferred.promise;
}
return loadCss;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment