When I place the Mousetrap javascript file (http://craig.is/killing/mice) in my Meteor app’s main directory, I get the following error:
Your app is crashing. Here's the latest log.
app/mousetrap.js:711
_addEvent(document, 'keypress', _handleKey);
^
ReferenceError: document is not defined
at app/mousetrap.js:711:15
at app/mousetrap.js:813:4
at /Users/Suchow/Desktop/Collective/.meteor/local/build/server/server.js:107:21
at Array.forEach (native)
at Function._.each._.forEach (/Users/Suchow/Desktop/Collective/.meteor/local/build/server/underscore.js:76:11)
at run (/Users/Suchow/Desktop/Collective/.meteor/local/build/server/server.js:93:7)
Exited with code: 1
Your application is crashing. Waiting for file change.
The error goes away when the Mousetrap file is placed in a client/ subdirectory. Why?
because server side doesn’t have dom.
if u put it in root, it has been loaded in both server and client side.
lib like sugarjs, momentjs can work both side.