mirror of
https://github.com/jsbin/jsbin.git
synced 2026-01-18 15:18:04 +00:00
Not /that/ useful, but affords me some stats.
This commit is contained in:
parent
5df02abaa1
commit
e32f37bd9a
@ -78,7 +78,7 @@ module.exports = {
|
||||
|
||||
clearTimeout(pending[id].timer);
|
||||
|
||||
// NOTE: this will only fire once per jsbin session -
|
||||
// NOTE: this will only fire once per jsbin session -
|
||||
// not for every panel sent - because we clear the timer
|
||||
pending[id].timer = setTimeout(function () {
|
||||
var session = sessionForBin(bin),
|
||||
@ -104,6 +104,7 @@ module.exports = {
|
||||
if (data) {
|
||||
session.res.forEach(function (res) {
|
||||
res.write('data:' + data.content.split('\n').join('\ndata:') + '\nevent:' + data.panelId + '\n\n');
|
||||
res.write('event: stats\ndata: ' + JSON.stringify({ connections: session.res.length }) + '\n\n');
|
||||
if (res.ajax) {
|
||||
res.end(); // lets older browsers finish their xhr request
|
||||
}
|
||||
@ -113,7 +114,7 @@ module.exports = {
|
||||
}, delayTrigger);
|
||||
},
|
||||
appendScripts: function (scripts) {
|
||||
// TODO this should really detect that there's an active session going
|
||||
// TODO this should really detect that there's an active session going
|
||||
// on and the user is saving, and therefore include the spike intelligently
|
||||
scripts.push('js/vendor/eventsource.js');
|
||||
scripts.push('js/spike.js');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user