Skip to content

Instantly share code, notes, and snippets.

@iDVB
Created February 11, 2014 04:03
Show Gist options
  • Select an option

  • Save iDVB/8929079 to your computer and use it in GitHub Desktop.

Select an option

Save iDVB/8929079 to your computer and use it in GitHub Desktop.
Rendr + Socket.io app_view.js
var BaseAppView = require('rendr/client/app_view')
, $ = require('jquery')
, io = require('socket.io')
;
module.exports = BaseAppView.extend({
postInitialize: function() {
var socket = io.connect('http://localhost');
socket.on('news', function (data) {
console.log(data);
socket.emit('my other event', { my: 'data' });
});
var $body = $('body');
this.app.on('change:loading', function(app, loading) {
$body.toggleClass('loading', loading);
});
this.app.on('change:title', function(app, title) {
document.title = title + ' | Rendr Example App';
});
var $stacks = $('#stacks div');
$('#panels .toolbar .button.toggle-lists').on("click", function(){
console.log("buttonPushed");
$stacks.toggleClass("slided");
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment