ethstats-server/public/js/services.js

32 lines
733 B
JavaScript
Raw Normal View History

2015-01-20 19:29:31 +01:00
'use strict';
/* Services */
app.factory('socket', function ($rootScope) {
var socket = io.connect();
return {
on: function (eventName, callback) {
socket.on(eventName, function () {
var args = arguments;
$rootScope.$apply(function () {
callback.apply(socket, args);
});
});
},
emit: function (eventName, data, callback) {
socket.emit(eventName, data, function () {
var args = arguments;
$rootScope.$apply(function () {
if (callback) {
callback.apply(socket, args);
}
});
})
}
};
2015-01-28 23:38:54 +01:00
});
var underscore = angular.module('underscore', []);
underscore.factory('_', function() {
return window._;
2015-01-20 19:29:31 +01:00
});