diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2012-04-02 02:13:32 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2012-04-02 02:13:32 -0400 |
| commit | 9b142c6dc7d5736acc45142a5d42c4511fc49edc (patch) | |
| tree | c236e9ec0dcc67e6809bd7addad012e41d5bf9b7 /app/js/services.js | |
| parent | a5edfb4b0a960307cdabcfab87d8bdae94f06b74 (diff) | |
| download | alias-9b142c6dc7d5736acc45142a5d42c4511fc49edc.tar.gz | |
new angular branch
Diffstat (limited to 'app/js/services.js')
| -rw-r--r-- | app/js/services.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/js/services.js b/app/js/services.js new file mode 100644 index 0000000..1b1882e --- /dev/null +++ b/app/js/services.js @@ -0,0 +1,23 @@ +'use strict'; + +angular.module('Alias.services', [], function($provide) { +$provide.factory('connection', + ['$log', function($log) { + function connect_callback(status){ + if ( status == Strophe.Status.CONNECTING ) { + $log('Strophe is connecting.'); + } else if ( status == Strophe.Status.CONNFAIL ) { + $log('Strophe failed to connect.'); + } else if ( status == Strophe.Status.DISCONNECTING ) { + $log('Strophe is disconnecting.'); + } else if ( status == Strophe.Status.DISCONNECTED ) { + $dev.log('Strophe is disconnected.'); + } else if ( status == Strophe.Status.CONNECTED ) { + $log('Strophe is connected.'); + } + }; + var connection = new Strophe.Connection(BOSH_SERVICE); + connection.connect(NAME, PASSWORD, connect_callback); + return connection; + }]); +});
\ No newline at end of file |
