Last active
December 15, 2015 00:19
-
-
Save zuk/5171770 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // npm install git://github.com/zuk/Backbone.Drowsy.git | |
| // ... or just put the git URL in in package.json's dependencies | |
| var jQuery = require('jquery'); | |
| var _ = require('underscore'); | |
| var Backbone = require('backbone'); | |
| Backbone.$ = jQuery; | |
| var Drowsy = require('backbone.drowsy').Drowsy; | |
| var Wakeful = require('backbone.drowsy/wakeful').Wakeful; | |
| var fs = require('fs'); | |
| var config = JSON.parse(fs.readFileSync('./config.json')); | |
| var EvoRoom = {}; | |
| EvoRoom.Model = require('./js/evoroom.model.js').Model; | |
| var DATABASE = 'evo4-march-2013'; | |
| EvoRoom.Model.init(config.drowsy.url, DATABASE).done(function () { | |
| var users = new EvoRoom.Model.Users(); | |
| users.wake(config.wakeful.url); | |
| users.on('change add', updateUserStuff); | |
| users.on('reset', function () { | |
| users.each(updateUserStuff) | |
| }); | |
| }); | |
| function updateUserStuff(user) { | |
| console.log("doing stuff for", user); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment