osx - coffeescript can't find localStorage -


i'm trying teach myself coffeescript, falling short when trying use localstorage.

$ coffee detail_view.coffee  referenceerror: localstorage not defined   @ isloggedin (/users/me/workspace/hero/html_client/detail_view.coffee:12:18, <js>:5:13)   @ object.<anonymous> (/users/me/workspace/hero/html_client/detail_view.coffee:225:4, <js>:144:7)   @ object.<anonymous> (/users/me/workspace/hero/html_client/detail_view.coffee:164:4)   @ module._compile (module.js:456:26) 

the line in detail_view.coffee is:

(localstorage.getitem("a_key") isnt null) , (localstorage.getitem("b_key") isnt null) 

i've tried installing localstorage through npm, doesn't help. i.e.

$ sudo npm -g install localstorage npm http https://registry.npmjs.org/localstorage npm http 404 https://registry.npmjs.org/localstorage localstorage@1.0.2 /usr/local/lib/node_modules/localstorage  $ echo 'export path=/usr/local/lib/node_modules/localstorage:$path' >> ~/.profile $ source ~/.profile $ coffee detail_view.coffee  referenceerror: localstorage not defined   @ isloggedin (/users/me/workspace/hero/html_client/detail_view.coffee:12:18, <js>:5:13)   @ object.<anonymous> (/users/me/workspace/hero/html_client/detail_view.coffee:225:4, <js>:144:7)   @ object.<anonymous> (/users/me/workspace/hero/html_client/detail_view.coffee:164:4)   @ module._compile (module.js:456:26) 

what missing?

localstorage feature provided web browser. in node.js doesn't exist. means if reference localstorage in script ran node.js errors.

and if install localstorage npm module mention, need require use it.

localstorage = require('localstorage') localstorage.getitem 'a_key' 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -