Created
July 2, 2014 17:49
-
-
Save EderRoger/3a97c96f22f5a676a82c to your computer and use it in GitHub Desktop.
RequireJS Socket.io client config
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
require.config({ | |
urlArgs: "bust=" + (new Date()).getTime(), | |
paths: { | |
angularSocketIO: '../../lib/angular-socket-io/socket', | |
socketio: 'http://127.0.0.1:8001/socket.io/socket.io.js' | |
}, | |
shim: { | |
'angular': {'exports': 'angular'}, | |
"angularSocketIO": ['angular'], | |
"socketio": { | |
exports: 'io' | |
} | |
}, | |
priority: [ | |
"angular" | |
] | |
}); | |
require( | |
[ | |
'angular', | |
'bootstrap', | |
'routes' | |
], | |
function (angular) { | |
'use strict'; | |
angular.element(document).ready(function() { | |
angular.bootstrap(document, ['app']); | |
}); | |
}); |
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
define(['angular','socketio'], function (angular,io) { | |
'use strict'; | |
/* Services */ | |
angular.module('app.services', []) | |
.factory('socket', function (socketFactory) { | |
return socketFactory({ | |
prefix: 'foo~', | |
ioSocket: io.connect('localhost:8001') | |
}); | |
}) | |
; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment