Last active
August 29, 2015 14:13
-
-
Save jganoff/2917c2f2501b8f5bd9a1 to your computer and use it in GitHub Desktop.
PebbleJS in Node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clone PebbleJS' repo. This is the basis for all PebbleJS apps and includes | |
# libraries such as 'ajax', and 'ui'. | |
git clone git@github.com:pebble/pebblejs.git | |
# Tell Node where to find the PebbleJS modules | |
export NODE_PATH=$NODE_PATH:$(pwd)/pebblejs/js:$(pwd)/pebblejs/js/lib | |
# Pull down the XMLHttpRequest module into the current working directory. | |
# The 'ajax' module requires this. | |
npm install xmlhttprequest | |
# Load Pebble's Best Practices guide as a test that ajax works. | |
node -e " | |
// Make XMLHttpRequest available globally. | |
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; | |
// Test the 'ajax' module from PebbleJS. | |
require('ajax')( | |
{ | |
url: 'http://developer.getpebble.com/guides/best-practices/' | |
}, | |
function(data) { console.log(data); }, | |
function(error) { console.log(error); } | |
); | |
" | |
# Now you have a working Node environment that mimics what PebbleJS has | |
# access to - minus the UI components. This is enough for my prototyping | |
# for now; hopefully yours to. I may put together a UI simulator if I | |
# need to. Until then, happy hacking! | |
# - Jordan |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment