@base-framework/base 3.0.79 → 3.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.js +1 -1
- package/dist/base.js.map +3 -3
- package/dist/types/base.d.ts +25 -0
- package/dist/types/main/base.d.ts +94 -0
- package/dist/types/main/data-tracker/data-tracker.d.ts +93 -0
- package/dist/types/main/data-tracker/tracker-types.d.ts +23 -0
- package/dist/types/main/data-tracker/tracker.d.ts +56 -0
- package/dist/types/main/equals.d.ts +1 -0
- package/dist/types/main/events/event-methods.d.ts +124 -0
- package/dist/types/main/events/events.d.ts +208 -0
- package/dist/types/modules/ajax/ajax.d.ts +153 -0
- package/dist/types/modules/animation/animation.d.ts +79 -0
- package/dist/types/modules/animations/animation-controller.d.ts +61 -0
- package/dist/types/modules/animations/animation.d.ts +28 -0
- package/dist/types/modules/animations/attr-movement.d.ts +5 -0
- package/dist/types/modules/animations/css-movement.d.ts +8 -0
- package/dist/types/modules/animations/movement-factory.d.ts +34 -0
- package/dist/types/modules/animations/movement.d.ts +24 -0
- package/dist/types/modules/animations/value.d.ts +30 -0
- package/dist/types/modules/atom/atom.d.ts +1 -0
- package/dist/types/modules/atom/atoms.d.ts +343 -0
- package/dist/types/modules/component/component.d.ts +99 -0
- package/dist/types/modules/component/event-helper.d.ts +59 -0
- package/dist/types/modules/component/jot.d.ts +1 -0
- package/dist/types/modules/component/parse-args.d.ts +1 -0
- package/dist/types/modules/component/state-helper.d.ts +102 -0
- package/dist/types/modules/component/unit.d.ts +281 -0
- package/dist/types/modules/data/attrs.d.ts +1 -0
- package/dist/types/modules/data/basic-data.d.ts +259 -0
- package/dist/types/modules/data/data-proxy.d.ts +1 -0
- package/dist/types/modules/data/data-utils.d.ts +17 -0
- package/dist/types/modules/data/data.d.ts +3 -0
- package/dist/types/modules/data/deep-data.d.ts +162 -0
- package/dist/types/modules/data/model-service.d.ts +280 -0
- package/dist/types/modules/data/model.d.ts +33 -0
- package/dist/types/modules/data/simple-data.d.ts +12 -0
- package/dist/types/modules/data-binder/connection-tracker/connection-tracker.d.ts +45 -0
- package/dist/types/modules/data-binder/connection-tracker/connections/connection.d.ts +15 -0
- package/dist/types/modules/data-binder/connection-tracker/connections/one-way-connection.d.ts +23 -0
- package/dist/types/modules/data-binder/connection-tracker/connections/two-way-connection.d.ts +62 -0
- package/dist/types/modules/data-binder/data-binder.d.ts +175 -0
- package/dist/types/modules/data-binder/data-pub-sub.d.ts +66 -0
- package/dist/types/modules/data-binder/sources/data-source.d.ts +51 -0
- package/dist/types/modules/data-binder/sources/element-source.d.ts +84 -0
- package/dist/types/modules/data-binder/sources/one-way-source.d.ts +33 -0
- package/dist/types/modules/data-binder/sources/source.d.ts +26 -0
- package/dist/types/modules/data-binder/sources/two-way-source.d.ts +42 -0
- package/dist/types/modules/date/date-time.d.ts +165 -0
- package/dist/types/modules/history/history.d.ts +10 -0
- package/dist/types/modules/html/html.d.ts +136 -0
- package/dist/types/modules/import/import.d.ts +1 -0
- package/dist/types/modules/layout/builder.d.ts +102 -0
- package/dist/types/modules/layout/directives/core/aria/aria.d.ts +2 -0
- package/dist/types/modules/layout/directives/core/context/context-directives.d.ts +3 -0
- package/dist/types/modules/layout/directives/core/default-directives.d.ts +1 -0
- package/dist/types/modules/layout/directives/core/dom-methods.d.ts +1 -0
- package/dist/types/modules/layout/directives/core/parent/parent-directives.d.ts +5 -0
- package/dist/types/modules/layout/directives/core/reactive/bind.d.ts +1 -0
- package/dist/types/modules/layout/directives/core/reactive/for-each.d.ts +1 -0
- package/dist/types/modules/layout/directives/core/reactive/get-parent-data.d.ts +1 -0
- package/dist/types/modules/layout/directives/core/reactive/map.d.ts +1 -0
- package/dist/types/modules/layout/directives/core/reactive/on-created.d.ts +1 -0
- package/dist/types/modules/layout/directives/core/reactive/on-destroyed.d.ts +1 -0
- package/dist/types/modules/layout/directives/core/reactive/on-set.d.ts +1 -0
- package/dist/types/modules/layout/directives/core/reactive/on-state.d.ts +1 -0
- package/dist/types/modules/layout/directives/core/reactive/watch.d.ts +1 -0
- package/dist/types/modules/layout/directives/core/route.d.ts +1 -0
- package/dist/types/modules/layout/directives/core/switch.d.ts +1 -0
- package/dist/types/modules/layout/directives/directive.d.ts +1 -0
- package/dist/types/modules/layout/directives/directives.d.ts +25 -0
- package/dist/types/modules/layout/element/attribute-directive.d.ts +1 -0
- package/dist/types/modules/layout/element/attribute.d.ts +1 -0
- package/dist/types/modules/layout/element/element.d.ts +1 -0
- package/dist/types/modules/layout/element/parser.d.ts +65 -0
- package/dist/types/modules/layout/html-helper.d.ts +57 -0
- package/dist/types/modules/layout/render/browser-render.d.ts +10 -0
- package/dist/types/modules/layout/render/render-controller.d.ts +23 -0
- package/dist/types/modules/layout/render/render.d.ts +18 -0
- package/dist/types/modules/layout/render/server-render.d.ts +10 -0
- package/dist/types/modules/layout/watcher-helper.d.ts +103 -0
- package/dist/types/modules/mouse/mouse.d.ts +45 -0
- package/dist/types/modules/router/history/browser-history.d.ts +39 -0
- package/dist/types/modules/router/history/hash-history.d.ts +25 -0
- package/dist/types/modules/router/history/history-controller.d.ts +21 -0
- package/dist/types/modules/router/history/history.d.ts +35 -0
- package/dist/types/modules/router/nav-link.d.ts +37 -0
- package/dist/types/modules/router/router.d.ts +268 -0
- package/dist/types/modules/router/routes/component-helper.d.ts +75 -0
- package/dist/types/modules/router/routes/param-pattern.d.ts +2 -0
- package/dist/types/modules/router/routes/route-pattern.d.ts +1 -0
- package/dist/types/modules/router/routes/route.d.ts +120 -0
- package/dist/types/modules/router/set-title.d.ts +1 -0
- package/dist/types/modules/router/utils.d.ts +9 -0
- package/dist/types/modules/state/state-target.d.ts +45 -0
- package/dist/types/modules/state/state-tracker.d.ts +103 -0
- package/dist/types/shared/arrays.d.ts +26 -0
- package/dist/types/shared/dom.d.ts +272 -0
- package/dist/types/shared/encode/encode.d.ts +38 -0
- package/dist/types/shared/encode/json.d.ts +15 -0
- package/dist/types/shared/objects.d.ts +62 -0
- package/dist/types/shared/strings.d.ts +34 -0
- package/dist/types/shared/types.d.ts +52 -0
- package/package.json +5 -3
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
export { DataPubSub } from "./data-pub-sub.js";
|
|
2
|
+
/**
|
|
3
|
+
* DataBinder
|
|
4
|
+
*
|
|
5
|
+
* This will create a data binder object that can
|
|
6
|
+
* create one way and two way data bindings.
|
|
7
|
+
*
|
|
8
|
+
* @class
|
|
9
|
+
*/
|
|
10
|
+
export class DataBinder {
|
|
11
|
+
/**
|
|
12
|
+
* @member {string} version
|
|
13
|
+
*/
|
|
14
|
+
version: string;
|
|
15
|
+
/**
|
|
16
|
+
* @member {string} attr
|
|
17
|
+
*/
|
|
18
|
+
attr: string;
|
|
19
|
+
/**
|
|
20
|
+
* @member {array} blockedKeys
|
|
21
|
+
* @protected
|
|
22
|
+
*/
|
|
23
|
+
protected blockedKeys: number[];
|
|
24
|
+
/**
|
|
25
|
+
* @member {object} connections
|
|
26
|
+
* @protected
|
|
27
|
+
*/
|
|
28
|
+
protected connections: ConnectionTracker;
|
|
29
|
+
/**
|
|
30
|
+
* @member {object} pubSub
|
|
31
|
+
* @protected
|
|
32
|
+
*/
|
|
33
|
+
protected pubSub: DataPubSub;
|
|
34
|
+
/**
|
|
35
|
+
* @member {number} idCount
|
|
36
|
+
*/
|
|
37
|
+
idCount: number;
|
|
38
|
+
/**
|
|
39
|
+
* This will setup the events.
|
|
40
|
+
*
|
|
41
|
+
* @protected
|
|
42
|
+
* @returns {void}
|
|
43
|
+
*/
|
|
44
|
+
protected setup(): void;
|
|
45
|
+
/**
|
|
46
|
+
* This will bind an element to a data property.
|
|
47
|
+
*
|
|
48
|
+
* @param {object} element
|
|
49
|
+
* @param {object} data
|
|
50
|
+
* @param {string} prop
|
|
51
|
+
* @param {(string|function)} [filter]
|
|
52
|
+
* @returns {object} an instance of the databinder.
|
|
53
|
+
*/
|
|
54
|
+
bind(element: object, data: object, prop: string, filter?: (string | Function)): object;
|
|
55
|
+
/**
|
|
56
|
+
* This will bind an element to a data property.
|
|
57
|
+
*
|
|
58
|
+
* @protected
|
|
59
|
+
* @param {object} element
|
|
60
|
+
* @param {object} data
|
|
61
|
+
* @param {string} prop
|
|
62
|
+
* @param {string} customAttr
|
|
63
|
+
* @param {(string|function)} [filter]
|
|
64
|
+
* @returns {object} The new connection.
|
|
65
|
+
*/
|
|
66
|
+
protected setupConnection(element: object, data: object, prop: string, customAttr: string, filter?: (string | Function)): object;
|
|
67
|
+
/**
|
|
68
|
+
* This will add a new connection to the
|
|
69
|
+
* connection tracker.
|
|
70
|
+
*
|
|
71
|
+
* @protected
|
|
72
|
+
* @param {string} id
|
|
73
|
+
* @param {string} attr
|
|
74
|
+
* @param {object} connection
|
|
75
|
+
* @returns {object}
|
|
76
|
+
*/
|
|
77
|
+
protected addConnection(id: string, attr: string, connection: object): object;
|
|
78
|
+
/**
|
|
79
|
+
* This will set the bind id.
|
|
80
|
+
*
|
|
81
|
+
* @protected
|
|
82
|
+
* @param {object} element
|
|
83
|
+
* @returns {string}
|
|
84
|
+
*/
|
|
85
|
+
protected setBindId(element: object): string;
|
|
86
|
+
/**
|
|
87
|
+
* This will get the bind id.
|
|
88
|
+
*
|
|
89
|
+
* @protected
|
|
90
|
+
* @param {object} element
|
|
91
|
+
* @returns {string}
|
|
92
|
+
*/
|
|
93
|
+
protected getBindId(element: object): string;
|
|
94
|
+
/**
|
|
95
|
+
* This will unbind the element.
|
|
96
|
+
*
|
|
97
|
+
* @param {object} element
|
|
98
|
+
* @returns {object} an instance of the data binder.
|
|
99
|
+
*/
|
|
100
|
+
unbind(element: object): object;
|
|
101
|
+
/**
|
|
102
|
+
* This will setup a watcher for an element.
|
|
103
|
+
*
|
|
104
|
+
* @param {object} element
|
|
105
|
+
* @param {object} data
|
|
106
|
+
* @param {string} prop
|
|
107
|
+
* @param {function} callBack
|
|
108
|
+
* @returns {object}
|
|
109
|
+
*/
|
|
110
|
+
watch(element: object, data: object, prop: string, callBack: Function): object;
|
|
111
|
+
/**
|
|
112
|
+
* This will remove a watcher from an element.
|
|
113
|
+
*
|
|
114
|
+
* @param {object} element
|
|
115
|
+
* @param {object} data
|
|
116
|
+
* @param {string} prop
|
|
117
|
+
* @returns {object}
|
|
118
|
+
*/
|
|
119
|
+
unwatch(element: object, data: object, prop: string): object;
|
|
120
|
+
/**
|
|
121
|
+
* This will publish to the pub sub.
|
|
122
|
+
*
|
|
123
|
+
* @param {string} msg
|
|
124
|
+
* @param {*} value
|
|
125
|
+
* @param {object} committer
|
|
126
|
+
* @returns {object} an instance of the data binder.
|
|
127
|
+
*/
|
|
128
|
+
publish(msg: string, value: any, committer: object): object;
|
|
129
|
+
/**
|
|
130
|
+
* This will check if an element is bound.
|
|
131
|
+
*
|
|
132
|
+
* @protected
|
|
133
|
+
* @param {object} element
|
|
134
|
+
* @returns {?string}
|
|
135
|
+
*/
|
|
136
|
+
protected isDataBound(element: object): string | null;
|
|
137
|
+
/**
|
|
138
|
+
* This will check if the key is blocked.
|
|
139
|
+
*
|
|
140
|
+
* @protected
|
|
141
|
+
* @param {object} evt
|
|
142
|
+
* @returns {boolean}
|
|
143
|
+
*/
|
|
144
|
+
protected isBlocked(evt: object): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* This is the callBack for the chnage event.
|
|
147
|
+
*
|
|
148
|
+
* @param {object} evt
|
|
149
|
+
*/
|
|
150
|
+
bindHandler(evt: object): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* This wil setup the events.
|
|
153
|
+
*
|
|
154
|
+
* @protected
|
|
155
|
+
* @returns {void}
|
|
156
|
+
*/
|
|
157
|
+
protected setupEvents(): void;
|
|
158
|
+
changeHandler: any;
|
|
159
|
+
/**
|
|
160
|
+
* This will add the events.
|
|
161
|
+
*
|
|
162
|
+
* @protected
|
|
163
|
+
* @returns {void}
|
|
164
|
+
*/
|
|
165
|
+
protected addEvents(): void;
|
|
166
|
+
/**
|
|
167
|
+
* This will remove the events.
|
|
168
|
+
*
|
|
169
|
+
* @protected
|
|
170
|
+
* @returns {void}
|
|
171
|
+
*/
|
|
172
|
+
protected removeEvents(): void;
|
|
173
|
+
}
|
|
174
|
+
export const dataBinder: DataBinder;
|
|
175
|
+
import { ConnectionTracker } from './connection-tracker/connection-tracker.js';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DataPubSub
|
|
3
|
+
*
|
|
4
|
+
* This is a pub sub class to allow subscribers to
|
|
5
|
+
* listen for updates when published by publishers.
|
|
6
|
+
*
|
|
7
|
+
* @class
|
|
8
|
+
*/
|
|
9
|
+
export class DataPubSub {
|
|
10
|
+
/**
|
|
11
|
+
* @member {Map} callBacks
|
|
12
|
+
* @protected
|
|
13
|
+
*/
|
|
14
|
+
protected callBacks: Map<any, any>;
|
|
15
|
+
/**
|
|
16
|
+
* @member {number} lastToken
|
|
17
|
+
* @protected
|
|
18
|
+
*/
|
|
19
|
+
protected lastToken: number;
|
|
20
|
+
/**
|
|
21
|
+
* This will get a subscriber array.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} msg
|
|
24
|
+
* @returns {array}
|
|
25
|
+
*/
|
|
26
|
+
get(msg: string): any[];
|
|
27
|
+
/**
|
|
28
|
+
* This will reset pub sub.
|
|
29
|
+
*
|
|
30
|
+
* @returns {void}
|
|
31
|
+
*/
|
|
32
|
+
reset(): void;
|
|
33
|
+
/**
|
|
34
|
+
* This will add a subscriber.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} msg
|
|
37
|
+
* @param {function} callBack
|
|
38
|
+
* @returns {string} The subscriber token.
|
|
39
|
+
*/
|
|
40
|
+
on(msg: string, callBack: Function): string;
|
|
41
|
+
/**
|
|
42
|
+
* This will remove a subscriber.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} msg
|
|
45
|
+
* @param {string} token
|
|
46
|
+
* @returns {void}
|
|
47
|
+
*/
|
|
48
|
+
off(msg: string, token: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* This will delete a message.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} msg
|
|
53
|
+
* @returns {void}
|
|
54
|
+
*/
|
|
55
|
+
remove(msg: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* This will publish a message.
|
|
58
|
+
*
|
|
59
|
+
* @overload
|
|
60
|
+
* @param {string} msg
|
|
61
|
+
* @param {string} value
|
|
62
|
+
* @param {object} [committer]
|
|
63
|
+
* @returns {void}
|
|
64
|
+
*/
|
|
65
|
+
publish(msg: string, value: string, committer?: object): void;
|
|
66
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DataSource
|
|
3
|
+
*
|
|
4
|
+
* This will create a data source to use with
|
|
5
|
+
* a connection.
|
|
6
|
+
*
|
|
7
|
+
* @class
|
|
8
|
+
* @augments TwoWaySource
|
|
9
|
+
*/
|
|
10
|
+
export class DataSource extends TwoWaySource {
|
|
11
|
+
/**
|
|
12
|
+
* This will create a new data source.
|
|
13
|
+
*
|
|
14
|
+
* @constructor
|
|
15
|
+
* @param {object} data
|
|
16
|
+
* @param {string} prop
|
|
17
|
+
* @param {object} pubSub
|
|
18
|
+
*/
|
|
19
|
+
constructor(data: object, prop: string, pubSub: object);
|
|
20
|
+
/**
|
|
21
|
+
* @member {object} data
|
|
22
|
+
*/
|
|
23
|
+
data: any;
|
|
24
|
+
/**
|
|
25
|
+
* @member {string} prop
|
|
26
|
+
*/
|
|
27
|
+
prop: string;
|
|
28
|
+
/**
|
|
29
|
+
* This will set the data value.
|
|
30
|
+
*
|
|
31
|
+
* @param {*} value
|
|
32
|
+
* @returns {void}
|
|
33
|
+
*/
|
|
34
|
+
set(value: any): void;
|
|
35
|
+
/**
|
|
36
|
+
* This will get the data value.
|
|
37
|
+
*
|
|
38
|
+
* @returns {*}
|
|
39
|
+
*/
|
|
40
|
+
get(): any;
|
|
41
|
+
/**
|
|
42
|
+
* The callBack when updated.
|
|
43
|
+
*
|
|
44
|
+
* @overload
|
|
45
|
+
* @param {*} value
|
|
46
|
+
* @param {object} committer
|
|
47
|
+
* @returns {void}
|
|
48
|
+
*/
|
|
49
|
+
callBack(value: any, committer: object): void;
|
|
50
|
+
}
|
|
51
|
+
import { TwoWaySource } from './two-way-source.js';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ElementSource
|
|
3
|
+
*
|
|
4
|
+
* This will create an element source to use with
|
|
5
|
+
* a connection.
|
|
6
|
+
*
|
|
7
|
+
* @class
|
|
8
|
+
* @augments TwoWaySource
|
|
9
|
+
*/
|
|
10
|
+
export class ElementSource extends TwoWaySource {
|
|
11
|
+
/**
|
|
12
|
+
* This will create a new element source.
|
|
13
|
+
*
|
|
14
|
+
* @constructor
|
|
15
|
+
* @param {object} element
|
|
16
|
+
* @param {string} attr
|
|
17
|
+
* @param {string|function} filter
|
|
18
|
+
* @param {object} pubSub
|
|
19
|
+
*/
|
|
20
|
+
constructor(element: object, attr: string, filter: string | Function, pubSub: object);
|
|
21
|
+
/**
|
|
22
|
+
* @member {object} element
|
|
23
|
+
*/
|
|
24
|
+
element: any;
|
|
25
|
+
/**
|
|
26
|
+
* @member {string} attr
|
|
27
|
+
*/
|
|
28
|
+
attr: string;
|
|
29
|
+
/**
|
|
30
|
+
* @member {function} filter
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
private filter;
|
|
34
|
+
/**
|
|
35
|
+
* This will set up the set and get methods.
|
|
36
|
+
*
|
|
37
|
+
* @private
|
|
38
|
+
* @param {object} element
|
|
39
|
+
* @param {string} attr
|
|
40
|
+
* @returns {object}
|
|
41
|
+
*/
|
|
42
|
+
private addSetMethod;
|
|
43
|
+
setValue: ((element: any, attr: string, value: any) => void) | ((element: any, attr: string, value: any) => void) | ((element: any, attr: string, value: any) => void) | ((element: any, attr: string, value: any) => void);
|
|
44
|
+
getValue: ((element: any, attr: string) => any) | ((element: any, attr: string) => any);
|
|
45
|
+
/**
|
|
46
|
+
* This will get the bind attribute.
|
|
47
|
+
*
|
|
48
|
+
* @private
|
|
49
|
+
* @param {string} [customAttr]
|
|
50
|
+
* @returns {string}
|
|
51
|
+
*/
|
|
52
|
+
private getAttrBind;
|
|
53
|
+
/**
|
|
54
|
+
* This will setup a filter callBack.
|
|
55
|
+
*
|
|
56
|
+
* @private
|
|
57
|
+
* @param {string} filter
|
|
58
|
+
* @returns {function}
|
|
59
|
+
*/
|
|
60
|
+
private setupFilter;
|
|
61
|
+
/**
|
|
62
|
+
* This will set a value on an element.
|
|
63
|
+
*
|
|
64
|
+
* @param {*} value
|
|
65
|
+
* @returns {object}
|
|
66
|
+
*/
|
|
67
|
+
set(value: any): object;
|
|
68
|
+
/**
|
|
69
|
+
* This will get the value from an element.
|
|
70
|
+
*
|
|
71
|
+
* @returns {*}
|
|
72
|
+
*/
|
|
73
|
+
get(): any;
|
|
74
|
+
/**
|
|
75
|
+
* The callBack when updated.
|
|
76
|
+
*
|
|
77
|
+
* @overload
|
|
78
|
+
* @param {*} value
|
|
79
|
+
* @param {object} committer
|
|
80
|
+
* @returns {object}
|
|
81
|
+
*/
|
|
82
|
+
callBack(value: any, committer: object): object;
|
|
83
|
+
}
|
|
84
|
+
import { TwoWaySource } from './two-way-source.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OneWaySource
|
|
3
|
+
*
|
|
4
|
+
* This will create a one way source to use with
|
|
5
|
+
* a connection.
|
|
6
|
+
*
|
|
7
|
+
* @class
|
|
8
|
+
* @augments Source
|
|
9
|
+
*/
|
|
10
|
+
export class OneWaySource extends Source {
|
|
11
|
+
/**
|
|
12
|
+
* This will setup the data source.
|
|
13
|
+
*
|
|
14
|
+
* @param {object} data
|
|
15
|
+
*/
|
|
16
|
+
constructor(data: object);
|
|
17
|
+
data: any;
|
|
18
|
+
/**
|
|
19
|
+
* This will subscribe to a message.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} msg
|
|
22
|
+
* @param {function} callBack
|
|
23
|
+
* @returns {void}
|
|
24
|
+
*/
|
|
25
|
+
subscribe(msg: string, callBack: Function): void;
|
|
26
|
+
/**
|
|
27
|
+
* This will unsubscribe from the message.
|
|
28
|
+
*
|
|
29
|
+
* @returns {void}
|
|
30
|
+
*/
|
|
31
|
+
unsubscribe(): void;
|
|
32
|
+
}
|
|
33
|
+
import { Source } from './source.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source
|
|
3
|
+
*
|
|
4
|
+
* This will create a new source to use with
|
|
5
|
+
* a connection.
|
|
6
|
+
*
|
|
7
|
+
* @class
|
|
8
|
+
*/
|
|
9
|
+
export class Source {
|
|
10
|
+
/**
|
|
11
|
+
* @member {string} msg
|
|
12
|
+
* @protected
|
|
13
|
+
*/
|
|
14
|
+
protected msg: any;
|
|
15
|
+
/**
|
|
16
|
+
* @member {string} token
|
|
17
|
+
*/
|
|
18
|
+
token: string;
|
|
19
|
+
/**
|
|
20
|
+
* This will set the token.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} token
|
|
23
|
+
* @returns {void}
|
|
24
|
+
*/
|
|
25
|
+
setToken(token: string): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TwoWaySource
|
|
3
|
+
*
|
|
4
|
+
* This will create a two way source to use with
|
|
5
|
+
* a connection.
|
|
6
|
+
*
|
|
7
|
+
* @class
|
|
8
|
+
* @augments Source
|
|
9
|
+
*/
|
|
10
|
+
export class TwoWaySource extends Source {
|
|
11
|
+
/**
|
|
12
|
+
* This will create a new source.
|
|
13
|
+
*
|
|
14
|
+
* @constructor
|
|
15
|
+
* @param {object} pubSub
|
|
16
|
+
*/
|
|
17
|
+
constructor(pubSub: object);
|
|
18
|
+
/**
|
|
19
|
+
* @member {object} pubSub
|
|
20
|
+
*/
|
|
21
|
+
pubSub: any;
|
|
22
|
+
/**
|
|
23
|
+
* This will subscribe to a message.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} msg
|
|
26
|
+
* @returns {void}
|
|
27
|
+
*/
|
|
28
|
+
subscribe(msg: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* This will unsubscribe from a message.
|
|
31
|
+
*
|
|
32
|
+
* @returns {void}
|
|
33
|
+
*/
|
|
34
|
+
unsubscribe(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Override this to setup cource callBack.
|
|
37
|
+
*
|
|
38
|
+
* @returns {void}
|
|
39
|
+
*/
|
|
40
|
+
callBack(): void;
|
|
41
|
+
}
|
|
42
|
+
import { Source } from './source.js';
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
export namespace DateTime {
|
|
2
|
+
let monthNames: string[];
|
|
3
|
+
let dayNames: string[];
|
|
4
|
+
/**
|
|
5
|
+
* This will get the day name.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} [day]
|
|
8
|
+
* @param {boolean} [shortenName=false]
|
|
9
|
+
* @returns {?string}
|
|
10
|
+
*/
|
|
11
|
+
function getDayName(day?: number, shortenName?: boolean): string;
|
|
12
|
+
/**
|
|
13
|
+
* This will convert month to js.
|
|
14
|
+
*
|
|
15
|
+
* @param {number} month
|
|
16
|
+
* @returns {string}
|
|
17
|
+
*/
|
|
18
|
+
function convertJsMonth(month: number): string;
|
|
19
|
+
/**
|
|
20
|
+
* This will convert a date.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} dateString
|
|
23
|
+
* @param {boolean} addYear
|
|
24
|
+
* @returns {string}
|
|
25
|
+
*/
|
|
26
|
+
function convertDate(dateString: string, addYear: boolean): string;
|
|
27
|
+
/**
|
|
28
|
+
* This will add leading zero to number less than 10.
|
|
29
|
+
*
|
|
30
|
+
* @param {number} number
|
|
31
|
+
* @returns {string}
|
|
32
|
+
*/
|
|
33
|
+
function padNumber(number: number): string;
|
|
34
|
+
/**
|
|
35
|
+
* This will create a new date object.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} dateString
|
|
38
|
+
* @returns {Date}
|
|
39
|
+
*/
|
|
40
|
+
function createDate(dateString: string): Date;
|
|
41
|
+
/**
|
|
42
|
+
* This will format a date.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} type
|
|
45
|
+
* @param {string} dateString
|
|
46
|
+
* @returns {string}
|
|
47
|
+
*/
|
|
48
|
+
function format(type: string, dateString: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* This will format time.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} dateString
|
|
53
|
+
* @param {number} format
|
|
54
|
+
* @returns {string}
|
|
55
|
+
*/
|
|
56
|
+
function formatTime(dateString: string, format: number): string;
|
|
57
|
+
/**
|
|
58
|
+
* This will check for leap year.
|
|
59
|
+
*
|
|
60
|
+
* @param {number} year
|
|
61
|
+
* @returns {boolean}
|
|
62
|
+
*/
|
|
63
|
+
function leapYear(year: number): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* This will get a month name.
|
|
66
|
+
*
|
|
67
|
+
* @param {number} [month]
|
|
68
|
+
* @param {boolean} [shortenName]
|
|
69
|
+
* @returns {string}
|
|
70
|
+
*/
|
|
71
|
+
function getMonthName(month?: number, shortenName?: boolean): string;
|
|
72
|
+
/**
|
|
73
|
+
* This will return the month length.
|
|
74
|
+
*
|
|
75
|
+
* @param {number} [month]
|
|
76
|
+
* @param {number} [year]
|
|
77
|
+
* @returns {number}
|
|
78
|
+
*/
|
|
79
|
+
function getMonthLength(month?: number, year?: number): number;
|
|
80
|
+
/**
|
|
81
|
+
* This will get the length of all the months.
|
|
82
|
+
*
|
|
83
|
+
* @param {number} year
|
|
84
|
+
* @returns {array}
|
|
85
|
+
*/
|
|
86
|
+
function getMonthsLength(year?: number): any[];
|
|
87
|
+
/**
|
|
88
|
+
* This will get the difference from now.
|
|
89
|
+
*
|
|
90
|
+
* @param {string} date
|
|
91
|
+
* @param {boolean} [setHours]
|
|
92
|
+
* @returns {number}
|
|
93
|
+
*/
|
|
94
|
+
function getDiffFromNow(date: string, setHours?: boolean): number;
|
|
95
|
+
/**
|
|
96
|
+
* This will get the age.
|
|
97
|
+
*
|
|
98
|
+
* @param {string} date
|
|
99
|
+
* @returns {string}
|
|
100
|
+
*/
|
|
101
|
+
function getAge(date: string): string;
|
|
102
|
+
/**
|
|
103
|
+
* This will get the time frame.
|
|
104
|
+
*
|
|
105
|
+
* @param {string} date
|
|
106
|
+
* @returns {string}
|
|
107
|
+
*/
|
|
108
|
+
function getTimeFrame(date: string): string;
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @param {number} milliseconds
|
|
112
|
+
* @returns {string}
|
|
113
|
+
*/
|
|
114
|
+
function convertToEstimate(milliseconds: number): string;
|
|
115
|
+
/**
|
|
116
|
+
* This will convert to years.
|
|
117
|
+
*
|
|
118
|
+
* @param {number} milliseconds
|
|
119
|
+
* @returns {number}
|
|
120
|
+
*/
|
|
121
|
+
function toYears(milliseconds: number): number;
|
|
122
|
+
/**
|
|
123
|
+
* This will convert to months.
|
|
124
|
+
*
|
|
125
|
+
* @param {number} milliseconds
|
|
126
|
+
* @returns {number}
|
|
127
|
+
*/
|
|
128
|
+
function toMonths(milliseconds: number): number;
|
|
129
|
+
/**
|
|
130
|
+
* This will convert to days.
|
|
131
|
+
*
|
|
132
|
+
* @param {number} milliseconds
|
|
133
|
+
* @returns {number}
|
|
134
|
+
*/
|
|
135
|
+
function toDays(milliseconds: number): number;
|
|
136
|
+
/**
|
|
137
|
+
* This will convert to hours.
|
|
138
|
+
*
|
|
139
|
+
* @param {number} milliseconds
|
|
140
|
+
* @returns {number}
|
|
141
|
+
*/
|
|
142
|
+
function toHours(milliseconds: number): number;
|
|
143
|
+
/**
|
|
144
|
+
* This will convert to minutes.
|
|
145
|
+
*
|
|
146
|
+
* @param {number} milliseconds
|
|
147
|
+
* @returns {number}
|
|
148
|
+
*/
|
|
149
|
+
function toMinutes(milliseconds: number): number;
|
|
150
|
+
/**
|
|
151
|
+
* This will convert to seconds.
|
|
152
|
+
*
|
|
153
|
+
* @param {number} milliseconds
|
|
154
|
+
* @returns {number}
|
|
155
|
+
*/
|
|
156
|
+
function toSeconds(milliseconds: number): number;
|
|
157
|
+
/**
|
|
158
|
+
* This will get the difference between two dates.
|
|
159
|
+
*
|
|
160
|
+
* @param {string} startDate
|
|
161
|
+
* @param {string} endDate
|
|
162
|
+
* @returns {object}
|
|
163
|
+
*/
|
|
164
|
+
function getDifference(startDate: string, endDate: string): any;
|
|
165
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export namespace history {
|
|
2
|
+
function isSupported(): boolean;
|
|
3
|
+
function addEvent(fn: any, capture: any): void;
|
|
4
|
+
function removeEvent(fn: any, capture: any): void;
|
|
5
|
+
function pushState(object: any, title: any, url: any): void;
|
|
6
|
+
function replaceState(object: any, title: any, url: any): void;
|
|
7
|
+
function nextState(): void;
|
|
8
|
+
function prevState(): void;
|
|
9
|
+
function goTo(indexNumber: any): void;
|
|
10
|
+
}
|