Permalink
Browse files

feat(Hammer Global): exposes Hammer on window or self if either is de…

…fined to avoid issues when AMD is present but not used.
  • Loading branch information...
runspired committed Nov 12, 2015
1 parent 439c7a6 commit 356f7955b01f3679c29d6c45931679256b45036e
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/expose.js
View
@@ -50,6 +50,11 @@ extend(Hammer, {
prefixed: prefixed
});
// this prevents errors when Hammer is loaded in the presence of an AMD
// style loader but by script tag, not by the loader.
var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {}));
freeGlobal.Hammer = Hammer;
if (typeof define === 'function' && define.amd) {
define(function() {
return Hammer;

0 comments on commit 356f795

Please sign in to comment.