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
var TodoList = app.LiveCollection.extend({ | |
... | |
}); |
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
var LiveCollection = Backbone.Collection.extend({ | |
... | |
_createEvent: function(body) { | |
... | |
// Look to see if this collection has any outstanding creates... | |
var idAttribute = this.model.prototype.idAttribute; | |
var unsaved = this.filter(function(model) { | |
return !model.id; |
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
var fayeClient = new Faye.Client('/faye'); | |
var LiveCollection = Backbone.Collection.extend({ | |
constructor: function(models, options) { | |
Backbone.Collection.prototype.constructor.call(this, models, options); | |
this.subscription = fayeClient.subscribe(this.url, this._fayeEvent, this); | |
}, | |
_fayeEvent: function(message) { |
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
// This method will send realtime notifications to the faye clients | |
function notifyClients(method, model, url) { | |
bayeux.getClient().publish(url, { | |
method: method, | |
body: model.toJSON() | |
}); | |
} | |
// Attach events to the mongoose schema. Since the default mongoose middleware makes it difficult to | |
// distinguish between a create and an update event, we use a small utility that helps us to do that. |
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
var fayeServer = new faye.NodeAdapter({mount: '/faye', timeout: 45}); | |
fayeServer.attach(httpServer); |
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
// Start a server | |
var Faye = require('faye'), | |
server = new Faye.NodeAdapter({mount: '/'}); | |
server.listen(8000); | |
// Create a client and subscribe to a channel | |
var client = new Faye.Client('http://localhost:8000/'); | |
client.subscribe('/messages', function(message) { alert('Got a message: ' + message.text); | |
}); | |
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
function reopenTransportOnHupSignal(fileTransport) { | |
process.on('SIGHUP', function() { | |
var fullname = path.join(fileTransport.dirname, fileTransport._getFile(false)); | |
function reopen() { | |
if (fileTransport._stream) { | |
fileTransport._stream.end(); | |
fileTransport._stream.destroySoon(); | |
} |
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
(function(XHR) { | |
"use strict"; | |
var stats = []; | |
var timeoutId = null; | |
var open = XHR.prototype.open; | |
var send = XHR.prototype.send; | |
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
<web-app> | |
<!-- ... --> | |
<servlet> | |
<servlet-name>compressionHandlingDefaultServlet</servlet-name> | |
<servlet-class>com.barclayswealth.fsvoc.presentation.PrecompressedStaticServlet</servlet-class> | |
<load-on-startup>1</load-on-startup> | |
</servlet> |
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
var DataBounce = function(dataUrl, config) { | |
config = config || {}; | |
var defaults = { | |
formName: "exportform", | |
filename: "", | |
exportFrameName: "exportFrame", | |
postUrl: "dataBounce" | |
}; |
NewerOlder