This repository was archived by the owner on Jun 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathmodule.js
56 lines (51 loc) · 2.16 KB
/
module.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import {moduleName} from './config';
import VertxEventBusWrapperProvider from './lib/VertxEventBusWrapperProvider';
import VertxEventBusServiceProvider from './lib/VertxEventBusServiceProvider';
/**
* @ngdoc overview
* @module knalli.angular-vertxbus
* @name knalli.angular-vertxbus
* @description
*
* Client side library using VertX Event Bus as an Angular Service module
*
* You have to define the module dependency, this module is named `knalli.angular-vertxbus`.
*
* <pre>
* angular.module('app', ['knalli.angular-vertxbus'])
* .controller('MyCtrl', function(vertxEventBus, vertxEventBusService) {
*
* // using the EventBus directly
* vertxEventBus.send('my.address', {data: 123}, function (reply) {
* // your reply comes here
* });
*
* // using the service
* vertxEventBusService.send('my.address', {data: 123}, {timeout: 500})
* .then(function (reply) {
* // your reply comes here
* })
* .catch(function (err) {
* // something went wrong, no connection, no login, timed out, or so
* });
* });
* </pre>
*
* The module itself provides following components:
* - {@link knalli.angular-vertxbus.vertxEventBus vertxEventBus}: a low level wrapper around `vertx.EventBus`
* - {@link knalli.angular-vertxbus.vertxEventBusService vertxEventBusService}: a high level service around the wrapper
*
* While the wrapper only provides one single instance (even on reconnects), the service supports automatically
* reconnect management, authorization and a clean promise based api.
*
* If you are looking for a low integration of `vertxbus.EventBus` as an AngularJS component, the wrapper will be your
* choice. The only difference (and requirement for the wrapper actually) is how it will manage and replace the
* underlying instance of the current `vertx.EventBus`.
*
* However, if you are looking for a simple, clean and promised based high api, the service is much better you.
*/
export default angular
.module(moduleName, ['ng'])
.provider('vertxEventBus', VertxEventBusWrapperProvider)
.provider('vertxEventBusService', VertxEventBusServiceProvider)
.name;