initial commit
This commit is contained in:
38
node_modules/vis/lib/module/hammer.js
generated
vendored
Normal file
38
node_modules/vis/lib/module/hammer.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Setup a mock hammer.js object, for unit testing.
|
||||
*
|
||||
* Inspiration: https://github.com/uber/deck.gl/pull/658
|
||||
*
|
||||
* @returns {{on: noop, off: noop, destroy: noop, emit: noop, get: get}}
|
||||
*/
|
||||
function hammerMock() {
|
||||
const noop = () => {};
|
||||
|
||||
return {
|
||||
on: noop,
|
||||
off: noop,
|
||||
destroy: noop,
|
||||
emit: noop,
|
||||
|
||||
get: function(m) { //eslint-disable-line no-unused-vars
|
||||
return {
|
||||
set: noop
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
var propagating = require('propagating-hammerjs');
|
||||
var Hammer = window['Hammer'] || require('hammerjs');
|
||||
module.exports = propagating(Hammer, {
|
||||
preventDefault: 'mouse'
|
||||
});
|
||||
}
|
||||
else {
|
||||
module.exports = function () {
|
||||
// hammer.js is only available in a browser, not in node.js. Replacing it with a mock object.
|
||||
return hammerMock();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user