Module pattern is now implemented via templating
Previously two modules were defined, Layout.js, which is the internal implementation, and main.js, which depended on Layout.js and performed the fill / extract functionality required for a public JavaScript API. This simplifies the implementation by just exposing a single UMD module by directly including Layout.js within the module wrapper. Fixes #103
This commit is contained in:
25
src/css-layout.js
Normal file
25
src/css-layout.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// UMD (Universal Module Definition)
|
||||
// See https://github.com/umdjs/umd for reference
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define([], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
root.computeLayout = factory();
|
||||
}
|
||||
}(this, function () {
|
||||
// @@include('./Layout.js')
|
||||
|
||||
return function(node) {
|
||||
node = computeLayout.fillNodes(node);
|
||||
computeLayout.computeLayout(node);
|
||||
node = computeLayout.extractNodes(node);
|
||||
return node;
|
||||
};
|
||||
}));
|
Reference in New Issue
Block a user