Browse Source

Fixed #18: Not loading hammer.js when running on node.js

css_transitions
josdejong 11 years ago
parent
commit
0a2cbdff14
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      src/module/imports.js

+ 11
- 1
src/module/imports.js View File

@ -5,4 +5,14 @@
// Try to load dependencies from the global window object.
// If not available there, load via require.
var moment = (typeof window !== 'undefined') && window['moment'] || require('moment');
var Hammer = (typeof window !== 'undefined') && window['Hammer'] || require('hammerjs');
var Hammer;
if (typeof window !== 'undefined') {
// load hammer.js only when running in a browser (where window is available)
Hammer = window['Hammer'] || require('hammerjs');
}
else {
Hammer = function () {
throw Error('hammer.js is only available in a browser, not in node.js.');
}
}

Loading…
Cancel
Save