postal.js/example/node/client/js/main.js
2012-04-20 01:53:46 -04:00

42 lines
1.1 KiB
JavaScript

var socket;
require.config( {
paths : {
'text' : 'lib/requirejs-text-1.0.2',
'backbone' : 'lib/backbone',
'underscore': 'lib/underscore',
'machina' : 'lib/machina',
'postal' : 'lib/postal',
'amplify' : 'lib/amplify',
'bus' : 'infrastructure/bus'
},
baseUrl: 'js'
} );
require( [ 'backbone', 'jquery', 'underscore', 'machina', 'postal', 'lib/postal.diagnostics', 'infrastructure/postal.socket-client' ],
function( Backbone, $, _, machina, postal ){
// for debugging purposes ONLY for now:
window.postal = postal;
/*postal.addWireTap( function( d, e ){
if( /search/.test(e.topic) ) {
console.log( JSON.stringify( e ) );
}
});
*/
postal.connections.socket.socketMgr.on( "*", function( evnt, data ){
var args = [].slice.call( arguments,1 );
if( args[0] === "postal.remote" ) {
//console.log( "FSM Event: " + evnt + " - " + JSON.stringify( args[0] ) );
}
else {
//console.log( "FSM Event: " + evnt + " - " + JSON.stringify( args ) );
}
});
require([ 'infrastructure/app' ], function( app ) {
window.app = app;
});
});