Put window.fabric under a build flag (#4199)

* moved global in a module

* fix package.json
This commit is contained in:
Andrea Bogazzi 2017-08-14 13:42:17 +02:00 committed by GitHub
parent a06b568968
commit b7d9047c9c
4 changed files with 6 additions and 4 deletions

View file

@ -8,8 +8,6 @@ if (typeof exports !== 'undefined') {
if (typeof document !== 'undefined' && typeof window !== 'undefined') {
fabric.document = document;
fabric.window = window;
// ensure globality even if entire library were function wrapped (as in Meteor.js packaging system)
window.fabric = fabric;
}
else {
// assume we're running under node.js when document/window are not present

View file

@ -123,7 +123,7 @@ function ifSpecifiedAMDInclude(amdLib) {
var filesToInclude = [
'HEADER.js',
ifSpecifiedInclude('global', 'src/globalFabric.js'),
ifSpecifiedInclude('gestures', 'lib/event.js'),
'src/mixins/observable.mixin.js',

View file

@ -35,7 +35,7 @@
},
"license": "MIT",
"scripts": {
"build": "node build.js modules=ALL exclude=json,gestures,accessors",
"build": "node build.js modules=ALL exclude=gestures,accessors",
"build:watch": "onchange 'src/**/**' 'HEADER.js' 'lib/**/**' -- npm run build_export",
"build_with_gestures": "node build.js modules=ALL exclude=json",
"build_export": "npm run build && npm run export_dist_to_site",

4
src/globalFabric.js Normal file
View file

@ -0,0 +1,4 @@
if (typeof document !== 'undefined' && typeof window !== 'undefined') {
// ensure globality even if entire library were function wrapped (as in Meteor.js packaging system)
window.fabric = fabric;
}