@angular-wave/angular.ts 0.9.1 → 0.9.3
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/@types/angular.d.ts +150 -0
- package/@types/animations/animate-cache.d.ts +50 -0
- package/@types/animations/animate-children-directive.d.ts +10 -0
- package/@types/animations/animate-css-driver.d.ts +18 -0
- package/@types/animations/animate-css.d.ts +18 -0
- package/@types/animations/animate-js-driver.d.ts +14 -0
- package/@types/animations/animate-js.d.ts +23 -0
- package/@types/animations/animate-queue.d.ts +28 -0
- package/@types/animations/animate-runner.d.ts +31 -0
- package/@types/animations/animate-swap.d.ts +9 -0
- package/@types/animations/animate.d.ts +450 -0
- package/@types/animations/animation.d.ts +14 -0
- package/@types/animations/interface.d.ts +17 -0
- package/@types/animations/raf-scheduler.d.ts +37 -0
- package/@types/animations/shared.d.ts +74 -0
- package/@types/core/compile/compile.d.ts +201 -0
- package/@types/core/controller/controller.d.ts +54 -0
- package/@types/core/di/injector.d.ts +22 -0
- package/@types/core/filter/filter.d.ts +23 -0
- package/@types/core/interpolate/interpolate.d.ts +38 -0
- package/@types/core/parse/ast/ast-node.d.ts +56 -0
- package/@types/core/parse/ast/ast.d.ts +164 -0
- package/@types/core/parse/lexer/lexer.d.ts +119 -0
- package/@types/core/parse/lexer/token.d.ts +17 -0
- package/@types/core/parse/parse.d.ts +33 -0
- package/@types/core/parse/parser/parser.d.ts +41 -0
- package/@types/core/sanitize/sanitize-uri.d.ts +40 -0
- package/@types/directive/aria/aria.d.ts +104 -0
- package/@types/directive/attrs/attrs.d.ts +8 -0
- package/@types/directive/bind/bind.d.ts +18 -0
- package/@types/directive/channel/channel.d.ts +10 -0
- package/@types/directive/class/class.d.ts +3 -0
- package/@types/directive/cloak/cloak.d.ts +4 -0
- package/@types/directive/controller/controller.d.ts +4 -0
- package/@types/directive/events/events.d.ts +21 -0
- package/@types/directive/form/form.d.ts +264 -0
- package/@types/directive/http/http.d.ts +46 -0
- package/@types/directive/if/if.d.ts +10 -0
- package/@types/directive/include/include.d.ts +28 -0
- package/@types/directive/init/init.d.ts +4 -0
- package/@types/directive/input/input.d.ts +70 -0
- package/@types/directive/messages/messages.d.ts +63 -0
- package/@types/directive/model/model.d.ts +515 -0
- package/@types/directive/model-options/model-options.d.ts +56 -0
- package/@types/directive/non-bindable/non-bindable.d.ts +4 -0
- package/@types/directive/observe/observe.d.ts +9 -0
- package/@types/directive/options/options.d.ts +13 -0
- package/@types/directive/ref/ref.d.ts +11 -0
- package/@types/directive/repeat/repeat.d.ts +11 -0
- package/@types/directive/script/script.d.ts +10 -0
- package/@types/directive/select/select.d.ts +15 -0
- package/@types/directive/setter/setter.d.ts +12 -0
- package/@types/directive/show-hide/show-hide.d.ts +19 -0
- package/@types/directive/style/style.d.ts +4 -0
- package/@types/directive/switch/switch.d.ts +18 -0
- package/@types/directive/transclude/transclude.d.ts +10 -0
- package/@types/directive/validators/validators.d.ts +149 -0
- package/@types/filters/filter.d.ts +4 -0
- package/@types/filters/filters.d.ts +38 -0
- package/@types/filters/limit-to.d.ts +4 -0
- package/@types/filters/order-by.d.ts +7 -0
- package/@types/index.d.ts +2 -0
- package/@types/interface.d.ts +5 -4
- package/@types/ng.d.ts +8 -0
- package/@types/router/common/trace.d.ts +66 -0
- package/@types/router/directives/state-directives.d.ts +46 -0
- package/@types/router/directives/view-directive.d.ts +138 -0
- package/@types/router/glob/glob.d.ts +81 -0
- package/@types/router/hooks/core-resolvables.d.ts +2 -0
- package/@types/router/hooks/ignored-transition.d.ts +1 -0
- package/@types/router/hooks/invalid-transition.d.ts +1 -0
- package/@types/router/hooks/lazy-load.d.ts +42 -0
- package/@types/router/hooks/on-enter-exit-retain.d.ts +3 -0
- package/@types/router/hooks/redirect-to.d.ts +4 -0
- package/@types/router/hooks/resolve.d.ts +4 -0
- package/@types/router/hooks/update-globals.d.ts +1 -0
- package/@types/router/hooks/url.d.ts +5 -0
- package/@types/router/hooks/views.d.ts +5 -0
- package/@types/router/params/interface.d.ts +606 -0
- package/@types/router/params/param-factory.d.ts +16 -0
- package/@types/router/params/param-type.d.ts +59 -0
- package/@types/router/params/param.d.ts +71 -0
- package/@types/router/params/state-params.d.ts +12 -0
- package/@types/router/path/path-node.d.ts +38 -0
- package/@types/router/path/path-utils.d.ts +88 -0
- package/@types/router/resolve/interface.d.ts +200 -0
- package/@types/router/resolve/resolvable.d.ts +50 -0
- package/@types/router/resolve/resolve-context.d.ts +93 -0
- package/@types/router/router.d.ts +47 -0
- package/@types/router/state/interface.d.ts +983 -0
- package/@types/router/state/state-builder.d.ts +95 -0
- package/@types/router/state/state-matcher.d.ts +7 -0
- package/@types/router/state/state-object.d.ts +83 -0
- package/@types/router/state/state-queue-manager.d.ts +29 -0
- package/@types/router/state/state-registry.d.ts +133 -0
- package/@types/router/state/state-service.d.ts +425 -0
- package/@types/router/state/target-state.d.ts +102 -0
- package/@types/router/state/views.d.ts +58 -0
- package/@types/router/state-filters.d.ts +39 -0
- package/@types/router/template-factory.d.ts +117 -0
- package/@types/router/transition/hook-builder.d.ts +45 -0
- package/@types/router/transition/hook-registry.d.ts +102 -0
- package/@types/router/transition/interface.d.ts +880 -0
- package/@types/router/transition/reject-factory.d.ts +43 -0
- package/@types/router/transition/transition-event-type.d.ts +24 -0
- package/@types/router/transition/transition-hook.d.ts +86 -0
- package/@types/router/transition/transition-service.d.ts +116 -0
- package/@types/router/transition/transition.d.ts +331 -0
- package/@types/router/url/url-config.d.ts +99 -0
- package/@types/router/url/url-matcher.d.ts +174 -0
- package/@types/router/url/url-rule.d.ts +161 -0
- package/@types/router/url/url-rules.d.ts +249 -0
- package/@types/router/url/url-service.d.ts +254 -0
- package/@types/router/view/interface.d.ts +44 -0
- package/@types/router/view/view.d.ts +149 -0
- package/@types/router/view-scroll.d.ts +10 -0
- package/@types/services/anchor-scroll.d.ts +25 -0
- package/@types/services/cookie-reader.d.ts +4 -0
- package/@types/services/http/http.d.ts +134 -0
- package/@types/services/http-backend/http-backend.d.ts +58 -0
- package/@types/services/sce/sce.d.ts +238 -0
- package/@types/services/template-request.d.ts +55 -0
- package/@types/shared/common.d.ts +197 -0
- package/@types/shared/hof.d.ts +108 -0
- package/@types/shared/predicates.d.ts +17 -0
- package/@types/shared/queue.d.ts +64 -0
- package/@types/shared/strings.d.ts +58 -0
- package/dist/angular-ts.esm.js +2 -3
- package/dist/angular-ts.umd.js +2 -3
- package/dist/angular-ts.umd.min.js +1 -1
- package/docs/layouts/shortcodes/version.html +1 -1
- package/package.json +1 -1
- package/src/interface.ts +5 -4
- package/src/services/pubsub/pubsub.js +0 -1
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
export function escapeForRegexp(s: any): any;
|
|
2
|
+
export function adjustMatcher(matcher: any): any;
|
|
3
|
+
export function SceProvider(): void;
|
|
4
|
+
export class SceProvider {
|
|
5
|
+
/**
|
|
6
|
+
* @param {boolean=} value If provided, then enables/disables SCE application-wide.
|
|
7
|
+
* @return {boolean} True if SCE is enabled, false otherwise.
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Enables/disables SCE and returns the current value.
|
|
11
|
+
*/
|
|
12
|
+
enabled: (value?: boolean | undefined, ...args: any[]) => boolean;
|
|
13
|
+
$get: (string | (($parse: any, $sceDelegate: any) => any))[];
|
|
14
|
+
}
|
|
15
|
+
export namespace SCE_CONTEXTS {
|
|
16
|
+
let HTML: string;
|
|
17
|
+
let CSS: string;
|
|
18
|
+
let MEDIA_URL: string;
|
|
19
|
+
let URL: string;
|
|
20
|
+
let RESOURCE_URL: string;
|
|
21
|
+
let JS: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict
|
|
25
|
+
* Contextual Escaping (SCE)} services to AngularTS.
|
|
26
|
+
*
|
|
27
|
+
* For an overview of this service and the functionnality it provides in AngularTS, see the main
|
|
28
|
+
* page for {@link ng.$sce SCE}. The current page is targeted for developers who need to alter how
|
|
29
|
+
* SCE works in their application, which shouldn't be needed in most cases.
|
|
30
|
+
*
|
|
31
|
+
* <div class="alert alert-danger">
|
|
32
|
+
* AngularTS strongly relies on contextual escaping for the security of bindings: disabling or
|
|
33
|
+
* modifying this might cause cross site scripting (XSS) vulnerabilities. For libraries owners,
|
|
34
|
+
* changes to this service will also influence users, so be extra careful and document your changes.
|
|
35
|
+
* </div>
|
|
36
|
+
*
|
|
37
|
+
* Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of
|
|
38
|
+
* the `$sce` service to customize the way Strict Contextual Escaping works in AngularTS. This is
|
|
39
|
+
* because, while the `$sce` provides numerous shorthand methods, etc., you really only need to
|
|
40
|
+
* override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things
|
|
41
|
+
* work because `$sce` delegates to `$sceDelegate` for these operations.
|
|
42
|
+
*
|
|
43
|
+
* Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.
|
|
44
|
+
*
|
|
45
|
+
* The default instance of `$sceDelegate` should work out of the box with little pain. While you
|
|
46
|
+
* can override it completely to change the behavior of `$sce`, the common case would
|
|
47
|
+
* involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting
|
|
48
|
+
* your own trusted and banned resource lists for trusting URLs used for loading AngularTS resources
|
|
49
|
+
* such as templates. Refer {@link ng.$sceDelegateProvider#trustedResourceUrlList
|
|
50
|
+
* $sceDelegateProvider.trustedResourceUrlList} and {@link
|
|
51
|
+
* ng.$sceDelegateProvider#bannedResourceUrlList $sceDelegateProvider.bannedResourceUrlList}
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate
|
|
56
|
+
* $sceDelegate service}, used as a delegate for {@link ng.$sce Strict Contextual Escaping (SCE)}.
|
|
57
|
+
*
|
|
58
|
+
* The `$sceDelegateProvider` allows one to get/set the `trustedResourceUrlList` and
|
|
59
|
+
* `bannedResourceUrlList` used to ensure that the URLs used for sourcing AngularTS templates and
|
|
60
|
+
* other script-running URLs are safe (all places that use the `$sce.RESOURCE_URL` context). See
|
|
61
|
+
* {@link ng.$sceDelegateProvider#trustedResourceUrlList
|
|
62
|
+
* $sceDelegateProvider.trustedResourceUrlList} and
|
|
63
|
+
* {@link ng.$sceDelegateProvider#bannedResourceUrlList $sceDelegateProvider.bannedResourceUrlList},
|
|
64
|
+
*
|
|
65
|
+
* For the general details about this service in AngularTS, read the main page for {@link ng.$sce
|
|
66
|
+
* Strict Contextual Escaping (SCE)}.
|
|
67
|
+
*
|
|
68
|
+
* **Example**: Consider the following case. <a name="example"></a>
|
|
69
|
+
*
|
|
70
|
+
* - your app is hosted at url `http://myapp.example.com/`
|
|
71
|
+
* - but some of your templates are hosted on other domains you control such as
|
|
72
|
+
* `http://srv01.assets.example.com/`, `http://srv02.assets.example.com/`, etc.
|
|
73
|
+
* - and you have an open redirect at `http://myapp.example.com/clickThru?...`.
|
|
74
|
+
*
|
|
75
|
+
* Here is what a secure configuration for this scenario might look like:
|
|
76
|
+
*
|
|
77
|
+
* ```
|
|
78
|
+
* angular.module('myApp', []).config(function($sceDelegateProvider) {
|
|
79
|
+
* $sceDelegateProvider.trustedResourceUrlList([
|
|
80
|
+
* // Allow same origin resource loads.
|
|
81
|
+
* 'self',
|
|
82
|
+
* // Allow loading from our assets domain. Notice the difference between * and **.
|
|
83
|
+
* 'http://srv*.assets.example.com/**'
|
|
84
|
+
* ]);
|
|
85
|
+
*
|
|
86
|
+
* // The banned resource URL list overrides the trusted resource URL list so the open redirect
|
|
87
|
+
* // here is blocked.
|
|
88
|
+
* $sceDelegateProvider.bannedResourceUrlList([
|
|
89
|
+
* 'http://myapp.example.com/clickThru**'
|
|
90
|
+
* ]);
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
* Note that an empty trusted resource URL list will block every resource URL from being loaded, and will require
|
|
94
|
+
* you to manually mark each one as trusted with `$sce.trustAsResourceUrl`. However, templates
|
|
95
|
+
* requested by {@link ng.$templateRequest $templateRequest} that are present in
|
|
96
|
+
* {@link ng.$templateCache $templateCache} will not go through this check. If you have a mechanism
|
|
97
|
+
* to populate your templates in that cache at config time, then it is a good idea to remove 'self'
|
|
98
|
+
* from the trusted resource URL lsit. This helps to mitigate the security impact of certain types
|
|
99
|
+
* of issues, like for instance attacker-controlled `ng-includes`.
|
|
100
|
+
*/
|
|
101
|
+
/**
|
|
102
|
+
* `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict
|
|
103
|
+
* Contextual Escaping (SCE)} services to AngularTS.
|
|
104
|
+
*
|
|
105
|
+
* For an overview of this service and the functionnality it provides in AngularTS, see the main
|
|
106
|
+
* page for {@link ng.$sce SCE}. The current page is targeted for developers who need to alter how
|
|
107
|
+
* SCE works in their application, which shouldn't be needed in most cases.
|
|
108
|
+
*
|
|
109
|
+
* <div class="alert alert-danger">
|
|
110
|
+
* AngularTS strongly relies on contextual escaping for the security of bindings: disabling or
|
|
111
|
+
* modifying this might cause cross site scripting (XSS) vulnerabilities. For libraries owners,
|
|
112
|
+
* changes to this service will also influence users, so be extra careful and document your changes.
|
|
113
|
+
* </div>
|
|
114
|
+
*
|
|
115
|
+
* Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of
|
|
116
|
+
* the `$sce` service to customize the way Strict Contextual Escaping works in AngularTS. This is
|
|
117
|
+
* because, while the `$sce` provides numerous shorthand methods, etc., you really only need to
|
|
118
|
+
* override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things
|
|
119
|
+
* work because `$sce` delegates to `$sceDelegate` for these operations.
|
|
120
|
+
*
|
|
121
|
+
* Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.
|
|
122
|
+
*
|
|
123
|
+
* The default instance of `$sceDelegate` should work out of the box with little pain. While you
|
|
124
|
+
* can override it completely to change the behavior of `$sce`, the common case would
|
|
125
|
+
* involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting
|
|
126
|
+
* your own trusted and banned resource lists for trusting URLs used for loading AngularTS resources
|
|
127
|
+
* such as templates. Refer {@link ng.$sceDelegateProvider#trustedResourceUrlList
|
|
128
|
+
* $sceDelegateProvider.trustedResourceUrlList} and {@link
|
|
129
|
+
* ng.$sceDelegateProvider#bannedResourceUrlList $sceDelegateProvider.bannedResourceUrlList}
|
|
130
|
+
*/
|
|
131
|
+
/**
|
|
132
|
+
*
|
|
133
|
+
* The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate
|
|
134
|
+
* $sceDelegate service}, used as a delegate for {@link ng.$sce Strict Contextual Escaping (SCE)}.
|
|
135
|
+
*
|
|
136
|
+
* The `$sceDelegateProvider` allows one to get/set the `trustedResourceUrlList` and
|
|
137
|
+
* `bannedResourceUrlList` used to ensure that the URLs used for sourcing AngularTS templates and
|
|
138
|
+
* other script-running URLs are safe (all places that use the `$sce.RESOURCE_URL` context). See
|
|
139
|
+
* {@link ng.$sceDelegateProvider#trustedResourceUrlList
|
|
140
|
+
* $sceDelegateProvider.trustedResourceUrlList} and
|
|
141
|
+
* {@link ng.$sceDelegateProvider#bannedResourceUrlList $sceDelegateProvider.bannedResourceUrlList},
|
|
142
|
+
*
|
|
143
|
+
* For the general details about this service in AngularTS, read the main page for {@link ng.$sce
|
|
144
|
+
* Strict Contextual Escaping (SCE)}.
|
|
145
|
+
*
|
|
146
|
+
* **Example**: Consider the following case. <a name="example"></a>
|
|
147
|
+
*
|
|
148
|
+
* - your app is hosted at url `http://myapp.example.com/`
|
|
149
|
+
* - but some of your templates are hosted on other domains you control such as
|
|
150
|
+
* `http://srv01.assets.example.com/`, `http://srv02.assets.example.com/`, etc.
|
|
151
|
+
* - and you have an open redirect at `http://myapp.example.com/clickThru?...`.
|
|
152
|
+
*
|
|
153
|
+
* Here is what a secure configuration for this scenario might look like:
|
|
154
|
+
*
|
|
155
|
+
* ```
|
|
156
|
+
* angular.module('myApp', []).config(function($sceDelegateProvider) {
|
|
157
|
+
* $sceDelegateProvider.trustedResourceUrlList([
|
|
158
|
+
* // Allow same origin resource loads.
|
|
159
|
+
* 'self',
|
|
160
|
+
* // Allow loading from our assets domain. Notice the difference between * and **.
|
|
161
|
+
* 'http://srv*.assets.example.com/**'
|
|
162
|
+
* ]);
|
|
163
|
+
*
|
|
164
|
+
* // The banned resource URL list overrides the trusted resource URL list so the open redirect
|
|
165
|
+
* // here is blocked.
|
|
166
|
+
* $sceDelegateProvider.bannedResourceUrlList([
|
|
167
|
+
* 'http://myapp.example.com/clickThru**'
|
|
168
|
+
* ]);
|
|
169
|
+
* });
|
|
170
|
+
* ```
|
|
171
|
+
* Note that an empty trusted resource URL list will block every resource URL from being loaded, and will require
|
|
172
|
+
* you to manually mark each one as trusted with `$sce.trustAsResourceUrl`. However, templates
|
|
173
|
+
* requested by {@link ng.$templateRequest $templateRequest} that are present in
|
|
174
|
+
* {@link ng.$templateCache $templateCache} will not go through this check. If you have a mechanism
|
|
175
|
+
* to populate your templates in that cache at config time, then it is a good idea to remove 'self'
|
|
176
|
+
* from the trusted resource URL lsit. This helps to mitigate the security impact of certain types
|
|
177
|
+
* of issues, like for instance attacker-controlled `ng-includes`.
|
|
178
|
+
*/
|
|
179
|
+
export class SceDelegateProvider {
|
|
180
|
+
/**
|
|
181
|
+
*
|
|
182
|
+
* @param {Array=} trustedResourceUrlList When provided, replaces the trustedResourceUrlList with
|
|
183
|
+
* the value provided. This must be an array or null. A snapshot of this array is used so
|
|
184
|
+
* further changes to the array are ignored.
|
|
185
|
+
* Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
|
|
186
|
+
* allowed in this array.
|
|
187
|
+
*
|
|
188
|
+
* @return {Array} The currently set trusted resource URL array.
|
|
189
|
+
*
|
|
190
|
+
* @description
|
|
191
|
+
* Sets/Gets the list trusted of resource URLs.
|
|
192
|
+
*
|
|
193
|
+
* The **default value** when no `trustedResourceUrlList` has been explicitly set is `['self']`
|
|
194
|
+
* allowing only same origin resource requests.
|
|
195
|
+
*
|
|
196
|
+
* <div class="alert alert-warning">
|
|
197
|
+
* **Note:** the default `trustedResourceUrlList` of 'self' is not recommended if your app shares
|
|
198
|
+
* its origin with other apps! It is a good idea to limit it to only your application's directory.
|
|
199
|
+
* </div>
|
|
200
|
+
*/
|
|
201
|
+
trustedResourceUrlList: (value: any, ...args: any[]) => any[];
|
|
202
|
+
/**
|
|
203
|
+
*
|
|
204
|
+
* @param {Array=} bannedResourceUrlList When provided, replaces the `bannedResourceUrlList` with
|
|
205
|
+
* the value provided. This must be an array or null. A snapshot of this array is used so
|
|
206
|
+
* further changes to the array are ignored.</p><p>
|
|
207
|
+
* Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
|
|
208
|
+
* allowed in this array.</p><p>
|
|
209
|
+
* The typical usage for the `bannedResourceUrlList` is to **block
|
|
210
|
+
* [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
|
|
211
|
+
* these would otherwise be trusted but actually return content from the redirected domain.
|
|
212
|
+
* </p><p>
|
|
213
|
+
* Finally, **the banned resource URL list overrides the trusted resource URL list** and has
|
|
214
|
+
* the final say.
|
|
215
|
+
*
|
|
216
|
+
* @return {Array} The currently set `bannedResourceUrlList` array.
|
|
217
|
+
*
|
|
218
|
+
* @description
|
|
219
|
+
* Sets/Gets the `bannedResourceUrlList` of trusted resource URLs.
|
|
220
|
+
*
|
|
221
|
+
* The **default value** when no trusted resource URL list has been explicitly set is the empty
|
|
222
|
+
* array (i.e. there is no `bannedResourceUrlList`.)
|
|
223
|
+
*/
|
|
224
|
+
bannedResourceUrlList: (value: any, ...args: any[]) => any[];
|
|
225
|
+
$get: (
|
|
226
|
+
| string
|
|
227
|
+
| ((
|
|
228
|
+
$injector: import("../../core/di/internal-injector.js").InjectorService,
|
|
229
|
+
$$sanitizeUri: any,
|
|
230
|
+
$exceptionHandler: ErrorHandler,
|
|
231
|
+
) => {
|
|
232
|
+
trustAs: (type: string, trustedValue: any) => any;
|
|
233
|
+
getTrusted: (type: string, maybeTrusted: any) => any;
|
|
234
|
+
valueOf: (maybeTrusted: any) => any;
|
|
235
|
+
})
|
|
236
|
+
)[];
|
|
237
|
+
}
|
|
238
|
+
export type ErrorHandler = import("../exception/interface.ts").Interface;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used to configure the options passed to the {@link $http} service when making a template request.
|
|
3
|
+
*
|
|
4
|
+
* For example, it can be used for specifying the "Accept" header that is sent to the server, when
|
|
5
|
+
* requesting a template.
|
|
6
|
+
*/
|
|
7
|
+
export function TemplateRequestProvider(): void;
|
|
8
|
+
export class TemplateRequestProvider {
|
|
9
|
+
/**
|
|
10
|
+
* The options to be passed to the {@link $http} service when making the request.
|
|
11
|
+
* You can use this to override options such as the "Accept" header for template requests.
|
|
12
|
+
* The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the
|
|
13
|
+
* options if not overridden here.
|
|
14
|
+
*
|
|
15
|
+
* @param {string=} val new value for the {@link $http} options.
|
|
16
|
+
* @returns {string|TemplateRequestProvider} Returns the {@link $http} options when used as getter and self if used as setter.
|
|
17
|
+
*/
|
|
18
|
+
httpOptions: (val?: string | undefined) => string | TemplateRequestProvider;
|
|
19
|
+
/**
|
|
20
|
+
* The `$templateRequest` service runs security checks then downloads the provided template using
|
|
21
|
+
* `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request
|
|
22
|
+
* fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the
|
|
23
|
+
* exception can be thwarted by setting the 2nd parameter of the function to true). Note that the
|
|
24
|
+
* contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted
|
|
25
|
+
* when `tpl` is of type string and `$templateCache` has the matching entry.
|
|
26
|
+
*
|
|
27
|
+
* If you want to pass custom options to the `$http` service, such as setting the Accept header you
|
|
28
|
+
* can configure this via {@link $templateRequestProvider#httpOptions}.
|
|
29
|
+
*
|
|
30
|
+
* `$templateRequest` is used internally by {@link $compile}, {@link ngRoute.$route}, and directives such
|
|
31
|
+
* as {@link ngInclude} to download and cache templates.
|
|
32
|
+
*
|
|
33
|
+
* 3rd party modules should use `$templateRequest` if their services or directives are loading
|
|
34
|
+
* templates.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} tpl The HTTP request template URL
|
|
37
|
+
* @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty
|
|
38
|
+
*
|
|
39
|
+
* @return {Promise} a promise for the HTTP response data of the given URL.
|
|
40
|
+
*
|
|
41
|
+
* @property {number} totalPendingRequests total amount of pending template requests being downloaded.
|
|
42
|
+
*/
|
|
43
|
+
$get: (
|
|
44
|
+
| string
|
|
45
|
+
| ((
|
|
46
|
+
$exceptionHandler: import("./exception/exception-handler.js").ErrorHandler,
|
|
47
|
+
$templateCache: import("../services/template-cache/interface.ts").TemplateCache,
|
|
48
|
+
$http: any,
|
|
49
|
+
$sce: any,
|
|
50
|
+
) => {
|
|
51
|
+
(tpl: any, ignoreRequestError: any): any;
|
|
52
|
+
totalPendingRequests: number;
|
|
53
|
+
})
|
|
54
|
+
)[];
|
|
55
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
export function equals(o1: any, o2: any): any;
|
|
2
|
+
/**
|
|
3
|
+
* Builds proxy functions on the `to` object which pass through to the `from` object.
|
|
4
|
+
*
|
|
5
|
+
* For each key in `fnNames`, creates a proxy function on the `to` object.
|
|
6
|
+
* The proxy function calls the real function on the `from` object.
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* #### Example:
|
|
10
|
+
* This example creates an new class instance whose functions are prebound to the new'd object.
|
|
11
|
+
* ```js
|
|
12
|
+
* class Foo {
|
|
13
|
+
* constructor(data) {
|
|
14
|
+
* // Binds all functions from Foo.prototype to 'this',
|
|
15
|
+
* // then copies them to 'this'
|
|
16
|
+
* bindFunctions(Foo.prototype, this, this);
|
|
17
|
+
* this.data = data;
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* log() {
|
|
21
|
+
* console.log(this.data);
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* let myFoo = new Foo([1,2,3]);
|
|
26
|
+
* var logit = myFoo.log;
|
|
27
|
+
* logit(); // logs [1, 2, 3] from the myFoo 'this' instance
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* #### Example:
|
|
31
|
+
* This example creates a bound version of a service function, and copies it to another object
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* var SomeService = {
|
|
35
|
+
* this.data = [3, 4, 5];
|
|
36
|
+
* this.log = function() {
|
|
37
|
+
* console.log(this.data);
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* // Constructor fn
|
|
42
|
+
* function OtherThing() {
|
|
43
|
+
* // Binds all functions from SomeService to SomeService,
|
|
44
|
+
* // then copies them to 'this'
|
|
45
|
+
* bindFunctions(SomeService, this, SomeService);
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* let myOtherThing = new OtherThing();
|
|
49
|
+
* myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @param source A function that returns the source object which contains the original functions to be bound
|
|
53
|
+
* @param target A function that returns the target object which will receive the bound functions
|
|
54
|
+
* @param bind A function that returns the object which the functions will be bound to
|
|
55
|
+
* @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object)
|
|
56
|
+
* @param latebind If true, the binding of the function is delayed until the first time it's invoked
|
|
57
|
+
*/
|
|
58
|
+
export function createProxyFunctions(
|
|
59
|
+
source: any,
|
|
60
|
+
target: any,
|
|
61
|
+
bind: any,
|
|
62
|
+
fnNames: any,
|
|
63
|
+
latebind?: boolean,
|
|
64
|
+
): any;
|
|
65
|
+
/**
|
|
66
|
+
* prototypal inheritance helper.
|
|
67
|
+
* Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it
|
|
68
|
+
*/
|
|
69
|
+
/**
|
|
70
|
+
* prototypal inheritance helper.
|
|
71
|
+
* Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it.
|
|
72
|
+
*
|
|
73
|
+
* @param {Object} parent - The object to be used as the prototype.
|
|
74
|
+
* @param {Object} [extra] - The object containing additional properties to be copied.
|
|
75
|
+
* @returns {Object} - A new object with `parent` as its prototype and properties from `extra`.
|
|
76
|
+
*/
|
|
77
|
+
export function inherit(parent: any, extra?: any): any;
|
|
78
|
+
export function _removeFrom(array: any, obj: any): any;
|
|
79
|
+
/**
|
|
80
|
+
* Applies a set of defaults to an options object. The options object is filtered
|
|
81
|
+
* to only those properties of the objects in the defaultsList.
|
|
82
|
+
* Earlier objects in the defaultsList take precedence when applying defaults.
|
|
83
|
+
*/
|
|
84
|
+
export function defaults(opts: any, ...defaultsList: any[]): any;
|
|
85
|
+
/**
|
|
86
|
+
* Finds the common ancestor path between two states.
|
|
87
|
+
*
|
|
88
|
+
* @param {Object} first The first state.
|
|
89
|
+
* @param {Object} second The second state.
|
|
90
|
+
* @return {Array} Returns an array of state names in descending order, not including the root.
|
|
91
|
+
*/
|
|
92
|
+
export function ancestors(first: any, second: any): any[];
|
|
93
|
+
/**
|
|
94
|
+
* Return a copy of the object only containing the whitelisted properties.
|
|
95
|
+
*
|
|
96
|
+
* #### Example:
|
|
97
|
+
* ```
|
|
98
|
+
* var foo = { a: 1, b: 2, c: 3 };
|
|
99
|
+
* var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }
|
|
100
|
+
* ```
|
|
101
|
+
* @param obj the source object
|
|
102
|
+
* @param propNames an Array of strings, which are the whitelisted property names
|
|
103
|
+
*/
|
|
104
|
+
export function pick(obj: any, propNames: any): {};
|
|
105
|
+
/**
|
|
106
|
+
* Return a copy of the object omitting the blacklisted properties.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* var foo = { a: 1, b: 2, c: 3 };
|
|
112
|
+
* var ab = omit(foo, ['a', 'b']); // { c: 3 }
|
|
113
|
+
* ```
|
|
114
|
+
* @param obj the source object
|
|
115
|
+
* @param propNames an Array of strings, which are the blacklisted property names
|
|
116
|
+
*/
|
|
117
|
+
export function omit(obj: any, propNames: any): {};
|
|
118
|
+
/** Filters an Array or an Object's properties based on a predicate */
|
|
119
|
+
export function filter(collection: any, callback: any): {};
|
|
120
|
+
/** Finds an object from an array, or a property of an object, that matches a predicate */
|
|
121
|
+
export function find(collection: any, callback: any): undefined;
|
|
122
|
+
/** Maps an array or object properties using a callback function */
|
|
123
|
+
export function map(collection: any, callback: any, target: any): any;
|
|
124
|
+
/**
|
|
125
|
+
* Reduce function that pushes an object to an array, then returns the array.
|
|
126
|
+
* Mostly just for [[flattenR]] and [[uniqR]]
|
|
127
|
+
*/
|
|
128
|
+
export function pushR(arr: any, obj: any): any;
|
|
129
|
+
export function assertFn(
|
|
130
|
+
predicateOrMap: any,
|
|
131
|
+
errMsg?: string,
|
|
132
|
+
): (obj: any) => any;
|
|
133
|
+
/**
|
|
134
|
+
* Given two or more parallel arrays, returns an array of tuples where
|
|
135
|
+
* each tuple is composed of [ a[i], b[i], ... z[i] ]
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* let foo = [ 0, 2, 4, 6 ];
|
|
141
|
+
* let bar = [ 1, 3, 5, 7 ];
|
|
142
|
+
* let baz = [ 10, 30, 50, 70 ];
|
|
143
|
+
* arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]
|
|
144
|
+
* arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
export function arrayTuples(...args: any[]): any[][];
|
|
148
|
+
/**
|
|
149
|
+
* Reduce function which builds an object from an array of [key, value] pairs.
|
|
150
|
+
*
|
|
151
|
+
* Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.
|
|
152
|
+
*
|
|
153
|
+
* Each keyValueTuple should be an array with values [ key: string, value: any ]
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* var pairs = [ ["fookey", "fooval"], ["barkey", "barval"] ]
|
|
159
|
+
*
|
|
160
|
+
* var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})
|
|
161
|
+
* // pairsToObj == { fookey: "fooval", barkey: "barval" }
|
|
162
|
+
*
|
|
163
|
+
* // Or, more simply:
|
|
164
|
+
* var pairsToObj = pairs.reduce(applyPairs, {})
|
|
165
|
+
* // pairsToObj == { fookey: "fooval", barkey: "barval" }
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
export function applyPairs(memo: any, keyValTuple: any): any;
|
|
169
|
+
/**
|
|
170
|
+
* Returns the last element of an array, or undefined if the array is empty.
|
|
171
|
+
* @template T
|
|
172
|
+
* @param {T[]} arr - The input array.
|
|
173
|
+
* @returns {T | undefined} The last element or undefined.
|
|
174
|
+
*/
|
|
175
|
+
export function tail<T>(arr: T[]): T | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* shallow copy from src to dest
|
|
178
|
+
*/
|
|
179
|
+
export function copy(src: any, dest: any): any;
|
|
180
|
+
/**
|
|
181
|
+
* Given an array, and an item, if the item is found in the array, it removes it (in-place).
|
|
182
|
+
* The same array is returned
|
|
183
|
+
*/
|
|
184
|
+
export const removeFrom: any;
|
|
185
|
+
export function allTrueR(memo: any, elem: any): any;
|
|
186
|
+
export function anyTrueR(memo: any, elem: any): any;
|
|
187
|
+
export function unnestR(memo: any, elem: any): any;
|
|
188
|
+
export function flattenR(memo: any, elem: any): any;
|
|
189
|
+
export function uniqR(acc: any, token: any): any;
|
|
190
|
+
export function unnest(arr: any): any;
|
|
191
|
+
export function assertPredicate(
|
|
192
|
+
predicateOrMap: any,
|
|
193
|
+
errMsg?: string,
|
|
194
|
+
): (obj: any) => any;
|
|
195
|
+
export function pairs(obj: any): any[][];
|
|
196
|
+
export function silenceUncaughtInPromise(promise: any): any;
|
|
197
|
+
export function silentRejection(error: any): any;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function.
|
|
3
|
+
*
|
|
4
|
+
* Given a function with N parameters, returns a new function that supports partial application.
|
|
5
|
+
* The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters,
|
|
6
|
+
* where M is less than N, it returns a new function that accepts the remaining parameters. It continues to
|
|
7
|
+
* accept more parameters until all N parameters have been supplied.
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* This contrived example uses a partially applied function as an predicate, which returns true
|
|
11
|
+
* if an object is found in both arrays.
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* // returns true if an object is in both of the two arrays
|
|
15
|
+
* function inBoth(array1, array2, object) {
|
|
16
|
+
* return array1.indexOf(object) !== -1 &&
|
|
17
|
+
* array2.indexOf(object) !== 1;
|
|
18
|
+
* }
|
|
19
|
+
* let obj1, obj2, obj3, obj4, obj5, obj6, obj7
|
|
20
|
+
* let foos = [obj1, obj3]
|
|
21
|
+
* let bars = [obj3, obj4, obj5]
|
|
22
|
+
*
|
|
23
|
+
* // A curried "copy" of inBoth
|
|
24
|
+
* let curriedInBoth = curry(inBoth);
|
|
25
|
+
* // Partially apply both the array1 and array2
|
|
26
|
+
* let inFoosAndBars = curriedInBoth(foos, bars);
|
|
27
|
+
*
|
|
28
|
+
* // Supply the final argument; since all arguments are
|
|
29
|
+
* // supplied, the original inBoth function is then called.
|
|
30
|
+
* let obj1InBoth = inFoosAndBars(obj1); // false
|
|
31
|
+
*
|
|
32
|
+
* // Use the inFoosAndBars as a predicate.
|
|
33
|
+
* // Filter, on each iteration, supplies the final argument
|
|
34
|
+
* let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ];
|
|
35
|
+
* let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ]
|
|
36
|
+
*
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param fn
|
|
40
|
+
* @returns {*|function(): (*|any)}
|
|
41
|
+
*/
|
|
42
|
+
export function curry(fn: any): any | (() => any | any);
|
|
43
|
+
/**
|
|
44
|
+
* Given a varargs list of functions, returns a function that composes the argument functions, right-to-left
|
|
45
|
+
* given: f(x), g(x), h(x)
|
|
46
|
+
* let composed = compose(f,g,h)
|
|
47
|
+
* then, composed is: f(g(h(x)))
|
|
48
|
+
*/
|
|
49
|
+
export function compose(...args: any[]): () => any;
|
|
50
|
+
/**
|
|
51
|
+
* Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right
|
|
52
|
+
* given: f(x), g(x), h(x)
|
|
53
|
+
* let piped = pipe(f,g,h);
|
|
54
|
+
* then, piped is: h(g(f(x)))
|
|
55
|
+
*/
|
|
56
|
+
export function pipe(...args: any[]): any;
|
|
57
|
+
/**
|
|
58
|
+
* Sorta like Pattern Matching (a functional programming conditional construct)
|
|
59
|
+
*
|
|
60
|
+
* See http://c2.com/cgi/wiki?PatternMatching
|
|
61
|
+
*
|
|
62
|
+
* This is a conditional construct which allows a series of predicates and output functions
|
|
63
|
+
* to be checked and then applied. Each predicate receives the input. If the predicate
|
|
64
|
+
* returns truthy, then its matching output function (mapping function) is provided with
|
|
65
|
+
* the input and, then the result is returned.
|
|
66
|
+
*
|
|
67
|
+
* Each combination (2-tuple) of predicate + output function should be placed in an array
|
|
68
|
+
* of size 2: [ predicate, mapFn ]
|
|
69
|
+
*
|
|
70
|
+
* These 2-tuples should be put in an outer array.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* // Here's a 2-tuple where the first element is the isString predicate
|
|
76
|
+
* // and the second element is a function that returns a description of the input
|
|
77
|
+
* let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];
|
|
78
|
+
*
|
|
79
|
+
* // Second tuple: predicate "isNumber", mapfn returns a description
|
|
80
|
+
* let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];
|
|
81
|
+
*
|
|
82
|
+
* let third = [ (input) => input === null, (input) => `Oh, null...` ];
|
|
83
|
+
*
|
|
84
|
+
* let fourth = [ (input) => input === undefined, (input) => `notdefined` ];
|
|
85
|
+
*
|
|
86
|
+
* let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);
|
|
87
|
+
*
|
|
88
|
+
* console.log(descriptionOf(undefined)); // 'notdefined'
|
|
89
|
+
* console.log(descriptionOf(55)); // '(55) That's a number!'
|
|
90
|
+
* console.log(descriptionOf("foo")); // 'Here's your string foo'
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @param struct A 2D array. Each element of the array should be an array, a 2-tuple,
|
|
94
|
+
* with a Predicate and a mapping/output function
|
|
95
|
+
* @returns {function(any): *}
|
|
96
|
+
*/
|
|
97
|
+
export function pattern(struct: any): (arg0: any) => any;
|
|
98
|
+
/**
|
|
99
|
+
* Given a property name and a value, returns a function that returns a boolean based on whether
|
|
100
|
+
* the passed object has a property that matches the value
|
|
101
|
+
* let obj = { foo: 1, name: "blarg" };
|
|
102
|
+
* let getName = propEq("name", "blarg");
|
|
103
|
+
* getName(obj) === true
|
|
104
|
+
*/
|
|
105
|
+
export const propEq: any;
|
|
106
|
+
export function parse(name: any): any;
|
|
107
|
+
export function is(ctor: any): (obj: any) => boolean;
|
|
108
|
+
export function val(v: any): () => any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Predicate which checks if a value is injectable
|
|
3
|
+
*
|
|
4
|
+
* A value is "injectable" if it is a function, or if it is an ng1 array-notation-style array
|
|
5
|
+
* where all the elements in the array are Strings, except the last one, which is a Function
|
|
6
|
+
* @param {*} val
|
|
7
|
+
* @returns {boolean}
|
|
8
|
+
*/
|
|
9
|
+
export function isInjectable(val: any): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Predicate which checks if a value looks like a Promise
|
|
12
|
+
*
|
|
13
|
+
* It is probably a Promise if it's an object, and it has a `then` property which is a Function
|
|
14
|
+
* @param {any} obj
|
|
15
|
+
* @returns {boolean}
|
|
16
|
+
*/
|
|
17
|
+
export function isPromise(obj: any): boolean;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple bounded FIFO queue with optional eviction notifications.
|
|
3
|
+
* @template T
|
|
4
|
+
*/
|
|
5
|
+
export class Queue<T> {
|
|
6
|
+
/**
|
|
7
|
+
* @param {T[]} [items=[]] - Initial queue items.
|
|
8
|
+
* @param {number|null} [limit=null] - Maximum allowed items before eviction (null = unlimited).
|
|
9
|
+
*/
|
|
10
|
+
constructor(items?: T[], limit?: number | null);
|
|
11
|
+
/** @type {T[]} */
|
|
12
|
+
_items: T[];
|
|
13
|
+
/** @type {number|null} */
|
|
14
|
+
_limit: number | null;
|
|
15
|
+
/** @type {Array<(item: T) => void>} */
|
|
16
|
+
_evictListeners: Array<(item: T) => void>;
|
|
17
|
+
/**
|
|
18
|
+
* Register a listener that will be called with the evicted item.
|
|
19
|
+
* @param {(item: T) => void} listener
|
|
20
|
+
*/
|
|
21
|
+
onEvict(listener: (item: T) => void): void;
|
|
22
|
+
/**
|
|
23
|
+
* Adds an item to the end of the queue, evicting the head if over limit.
|
|
24
|
+
* @param {T} item
|
|
25
|
+
* @returns {T}
|
|
26
|
+
*/
|
|
27
|
+
enqueue(item: T): T;
|
|
28
|
+
/**
|
|
29
|
+
* Removes the head item and notifies eviction listeners.
|
|
30
|
+
* @returns {T|undefined}
|
|
31
|
+
*/
|
|
32
|
+
evict(): T | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Removes and returns the first item in the queue.
|
|
35
|
+
* @returns {T|undefined}
|
|
36
|
+
*/
|
|
37
|
+
dequeue(): T | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Clears all items from the queue.
|
|
40
|
+
* @returns {T[]} The previously stored items.
|
|
41
|
+
*/
|
|
42
|
+
clear(): T[];
|
|
43
|
+
/**
|
|
44
|
+
* Returns the current number of items.
|
|
45
|
+
* @returns {number}
|
|
46
|
+
*/
|
|
47
|
+
size(): number;
|
|
48
|
+
/**
|
|
49
|
+
* Removes a specific item from the queue.
|
|
50
|
+
* @param {T} item
|
|
51
|
+
* @returns {T|false} The removed item, or false if not found.
|
|
52
|
+
*/
|
|
53
|
+
remove(item: T): T | false;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the item at the tail (last).
|
|
56
|
+
* @returns {T|undefined}
|
|
57
|
+
*/
|
|
58
|
+
peekTail(): T | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Returns the item at the head (first).
|
|
61
|
+
* @returns {T|undefined}
|
|
62
|
+
*/
|
|
63
|
+
peekHead(): T | undefined;
|
|
64
|
+
}
|