forked from ibm-js/delite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomElements.js
31 lines (29 loc) · 915 Bytes
/
customElements.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Plugin to define customElements object, loading custom-elements.min.js if necessary (only IE and Edge).
* @module delite/customElements
*/
define([
"require",
"requirejs-dplugins/has"
], function (req, has) {
"use strict";
return /** @lends module:delite/customElements */ {
/**
* Load custom-elements.min.js if it's required.
* @param {string} path - Simplified path. It will be expanded to convert {{theme}} to the current theme.
* @param {Function} require - AMD's require() method.
* @param {Function} onload - Callback function which will be called when the loading finishes
* and the stylesheet has been inserted.
* @private
*/
load: function (path, require, onload) {
if (has("builder") || typeof customElements !== "undefined") {
onload();
} else {
require(["custom-elements/custom-elements.min"], function () {
onload();
});
}
}
};
});