@conterra/ct-mapapps-typings 4.18.4-next.20241007040658 → 4.18.4-next.20241008035341
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/agssearch/api.d.ts +5 -4
- package/apprt/event/EventConstants.d.ts +1 -1
- package/apprt-core/AsyncTask.d.ts +4 -5
- package/apprt-core/BlockingTaskExecutor.d.ts +4 -6
- package/apprt-core/CancelablePromise.d.ts +6 -5
- package/apprt-core/Events.d.ts +23 -21
- package/apprt-core/Exception.d.ts +9 -9
- package/apprt-core/Logger.d.ts +7 -7
- package/apprt-core/Mutable.d.ts +35 -39
- package/apprt-core/Observable.d.ts +8 -6
- package/apprt-core/Observers.d.ts +40 -34
- package/apprt-core/Promise.d.ts +3 -3
- package/apprt-core/TaskExecutor.d.ts +3 -3
- package/apprt-core/assignWithPrototype.d.ts +23 -20
- package/apprt-core/async.d.ts +6 -6
- package/apprt-core/base64.d.ts +2 -2
- package/apprt-core/bindAsync.d.ts +9 -12
- package/apprt-core/clone.d.ts +13 -15
- package/apprt-core/comparators.d.ts +7 -7
- package/apprt-core/config.d.ts +5 -1
- package/apprt-core/delegate.d.ts +9 -9
- package/apprt-core/deprecate.d.ts +1 -1
- package/apprt-core/equals.d.ts +2 -2
- package/apprt-core/freeze.d.ts +1 -1
- package/apprt-core/global.d.ts +1 -1
- package/apprt-core/join.d.ts +14 -11
- package/apprt-core/load-css.d.ts +4 -4
- package/apprt-core/load-js.d.ts +5 -5
- package/apprt-core/promise-utils.d.ts +23 -23
- package/apprt-core/propertyToSymbol.d.ts +1 -1
- package/apprt-core/string-escape.d.ts +1 -1
- package/apprt-core/string-pattern.d.ts +1 -1
- package/apprt-core/string-replace.d.ts +10 -10
- package/apprt-core/url-utils.d.ts +2 -2
- package/apprt-core/when.d.ts +3 -3
- package/apprt-dom/index.d.ts +7 -7
- package/apprt-fetch/index.d.ts +17 -17
- package/apprt-streams/Stream.d.ts +34 -34
- package/coordinatetransformer/api/CoordinateTransformer.d.ts +15 -10
- package/coordinatetransformer/api/ProjectionStore.d.ts +7 -6
- package/coordinatetransformer/api/TransformationProvider.d.ts +11 -4
- package/coordinatetransformer/api/TransformerStrategy.d.ts +8 -5
- package/ct/util/css.d.ts +9 -8
- package/domains-system/api.d.ts +26 -30
- package/highlights/api.d.ts +6 -11
- package/integration-map/api.d.ts +38 -35
- package/map-actions/api.d.ts +9 -5
- package/map-config-api/api.d.ts +31 -3
- package/map-init/api.d.ts +5 -5
- package/map-widget/Constraints.d.ts +1 -1
- package/map-widget/MapWidgetFactory.d.ts +1 -1
- package/map-widget/MapWidgetModel.d.ts +1 -1
- package/map-widget/ViewReadyWatcher.d.ts +1 -1
- package/map-widget/__internal__/{I0BOBZBz.d.ts → DFiGfJS1.d.ts} +3 -3
- package/map-widget/api/Constraints.d.ts +1 -1
- package/map-widget/api/MapWidget.d.ts +1 -1
- package/map-widget/api/MapWidgetFactory.d.ts +1 -1
- package/map-widget/api/MapWidgetModel.d.ts +1 -1
- package/map-widget/api/MapWidgetRegistration.d.ts +23 -12
- package/map-widget/api/SrsChangeService.d.ts +1 -1
- package/map-widget/api/index.d.ts +1 -1
- package/package.json +1 -1
- package/popups/ContentUpdateProxy.d.ts +61 -33
- package/popups/api.d.ts +35 -38
- package/portal-security/api.d.ts +48 -0
- package/portal-security/package.json +5 -0
- package/result-api/__internal__/{Cf0JLId0.d.ts → LZ4ypyEL.d.ts} +12 -12
- package/result-api/api/actions.d.ts +1 -1
- package/result-api/api/formatting.d.ts +1 -1
- package/result-api/api/index.d.ts +1 -1
- package/result-api/api/model.d.ts +1 -1
- package/result-api/api/service.d.ts +3 -3
- package/result-api/api/ui.d.ts +2 -2
- package/search-api/api.d.ts +8 -1
- package/search-ui/api.d.ts +2 -2
- package/selection-resultcenter/CachingStore.d.ts +3 -3
- package/store-api/ComplexQuery.d.ts +1 -1
- package/store-api/QueryExecution.d.ts +12 -11
- package/store-api/QueryExecutions.d.ts +3 -2
- package/store-api/SpatialQuery.d.ts +9 -9
- package/store-api/utils.d.ts +9 -9
package/agssearch/api.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { AsyncStore } from 'store-api/api';
|
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* Use the service name `agssearch.AGSStoreFactory` to obtain a {@link AGSStoreFactory} reference for your component:
|
|
11
|
-
* ```
|
|
11
|
+
* ```json
|
|
12
12
|
* "components": [
|
|
13
13
|
* {
|
|
14
14
|
* "name": "MyExampleComponent",
|
|
@@ -24,10 +24,11 @@ import { AsyncStore } from 'store-api/api';
|
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* Use the obtained {@link AGSStoreFactory} to create new store instances.
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* class MyExampleComponent {
|
|
29
|
+
* _storeFactory: InjectedReference<AGSStoreFactory>;
|
|
29
30
|
* async exampleMethod() {
|
|
30
|
-
* const store = await this._storeFactory
|
|
31
|
+
* const store = await this._storeFactory!.createStore({
|
|
31
32
|
* id: "my-new-store",
|
|
32
33
|
* layerId: "a-valid-layer-id"
|
|
33
34
|
* // or url: "https://example.com/some/FeatureServer"
|
|
@@ -11,7 +11,7 @@ declare const _default: Readonly<{
|
|
|
11
11
|
* property must not receive events. More precisely, the value of each
|
|
12
12
|
* string must conform to the following grammar:
|
|
13
13
|
*
|
|
14
|
-
* ```
|
|
14
|
+
* ```
|
|
15
15
|
* topic-description := '*' | topic ( '/*' )?
|
|
16
16
|
* topic := token ( '/' token )*
|
|
17
17
|
* ```
|
|
@@ -41,12 +41,11 @@ interface Task<Args extends any[] = [], Result = void> {
|
|
|
41
41
|
* Wraps a callback into a task object which can be used to control the async execution of it.
|
|
42
42
|
*
|
|
43
43
|
* @example
|
|
44
|
-
* ```
|
|
44
|
+
* ```ts
|
|
45
45
|
* import AsyncTask from "apprt-core/AsyncTask";
|
|
46
|
-
*
|
|
47
|
-
* task.run(2)
|
|
48
|
-
*
|
|
49
|
-
* });
|
|
46
|
+
* const task = AsyncTask(x => x * 200);
|
|
47
|
+
* const r = await task.run(2);
|
|
48
|
+
* assert.strictEqual(r, 400);
|
|
50
49
|
* ```
|
|
51
50
|
*/
|
|
52
51
|
declare function createTask<Args extends any[], Result>(callback: (...args: Args) => Result | PromiseLike<Result>): Task<Args, Result>;
|
|
@@ -18,13 +18,11 @@ declare const _asyncTask: unique symbol;
|
|
|
18
18
|
* The difference to the {@link TaskExecutor} is that it only uses macro tasks and that task executions can be tracked
|
|
19
19
|
* by clients.
|
|
20
20
|
* @example
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* let task = function(){ doSomething(); };
|
|
21
|
+
* ```ts
|
|
22
|
+
* const executor = new BlockingTaskExecutor();
|
|
23
|
+
* const task = () => { doSomething(); }; // ... };
|
|
25
24
|
* // execute the task if others pushed before are finished.
|
|
26
|
-
*
|
|
27
|
-
* promise.then((result)=> {...});
|
|
25
|
+
* const result = await executor.push(task);
|
|
28
26
|
* ```
|
|
29
27
|
*/
|
|
30
28
|
declare class BlockingTaskExecutor {
|
|
@@ -21,14 +21,15 @@ declare class CancelablePromise<T> extends ExtendedPromise<T> {
|
|
|
21
21
|
* Creates Promise instances with "cancel" function.
|
|
22
22
|
* @param executor function defined as (resolve,reject,onCancelled)=> \{\}
|
|
23
23
|
* @example
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* const p = new CancelablePromise((resolve, reject, onCancelled) => {
|
|
26
|
+
* onCancelled(() => {
|
|
27
|
+
* doSomething();
|
|
28
|
+
* });
|
|
28
29
|
* });
|
|
29
30
|
*
|
|
30
31
|
* // grab cancel function for later cancellation
|
|
31
|
-
*
|
|
32
|
+
* const cancel = p.cancel;
|
|
32
33
|
*
|
|
33
34
|
* // now cancel
|
|
34
35
|
* cancel();
|
package/apprt-core/Events.d.ts
CHANGED
|
@@ -126,20 +126,20 @@ type EventIdentifier = string | symbol;
|
|
|
126
126
|
* @param listener event listener
|
|
127
127
|
* @returns handle with `remove` method
|
|
128
128
|
* @example
|
|
129
|
-
* ```
|
|
129
|
+
* ```ts
|
|
130
130
|
* // object as event channel
|
|
131
|
-
*
|
|
131
|
+
* const channel = {};
|
|
132
132
|
* // connect to event "changed"
|
|
133
|
-
* on(channel,"changed",(msg)=> console.log(msg));
|
|
133
|
+
* on(channel, "changed", (msg)=> console.log(msg));
|
|
134
134
|
*
|
|
135
135
|
* // it is possible to register to multiple events using ','
|
|
136
|
-
* on(channel,"changed,click",(msg)=> console.log(msg));
|
|
136
|
+
* on(channel, "changed,click", (msg)=> console.log(msg));
|
|
137
137
|
*
|
|
138
138
|
* // it is possible to register to any events using '*'
|
|
139
|
-
* on(channel,"*",(msg)=> console.log(msg));
|
|
139
|
+
* on(channel, "*", (msg)=> console.log(msg));
|
|
140
140
|
*
|
|
141
141
|
* // on provides handle to unregister
|
|
142
|
-
*
|
|
142
|
+
* const handle = on(channel, "changed", (msg)=> console.log(msg));
|
|
143
143
|
* // unregister using "remove"
|
|
144
144
|
* handle.remove();
|
|
145
145
|
* ```
|
|
@@ -151,15 +151,15 @@ declare function on<T = unknown | undefined>(target: any, eventName: EventIdenti
|
|
|
151
151
|
* @param eventName event name
|
|
152
152
|
* @param event the event arguments
|
|
153
153
|
* @example
|
|
154
|
-
* ```
|
|
154
|
+
* ```ts
|
|
155
155
|
* // object as event channel
|
|
156
|
-
*
|
|
156
|
+
* const channel = {};
|
|
157
157
|
*
|
|
158
158
|
* // connect to event "changed"
|
|
159
|
-
* on(channel,"changed",(msg)=> console.log(msg));
|
|
159
|
+
* on(channel, "changed", (msg)=> console.log(msg));
|
|
160
160
|
*
|
|
161
161
|
* // fire changed event
|
|
162
|
-
* emit(channel,"changed","my event msg");
|
|
162
|
+
* emit(channel, "changed", "my event msg");
|
|
163
163
|
* ```
|
|
164
164
|
*/
|
|
165
165
|
declare function emit<T = unknown>(target: any, eventName: EventIdentifier, ...event: [] | [T]): void;
|
|
@@ -169,15 +169,15 @@ declare function emit<T = unknown>(target: any, eventName: EventIdentifier, ...e
|
|
|
169
169
|
* @param eventName event name
|
|
170
170
|
* @param event the event arguments
|
|
171
171
|
* @example
|
|
172
|
-
* ```
|
|
172
|
+
* ```ts
|
|
173
173
|
* // object as event channel
|
|
174
|
-
*
|
|
174
|
+
* const channel = {};
|
|
175
175
|
*
|
|
176
176
|
* // connect to event "changed"
|
|
177
|
-
* on(channel,"changed",(msg)=> console.log(msg));
|
|
177
|
+
* on(channel, "changed", (msg)=> console.log(msg));
|
|
178
178
|
*
|
|
179
179
|
* // fire changed event
|
|
180
|
-
* emitSync(channel,"changed","my event msg");
|
|
180
|
+
* emitSync(channel, "changed", "my event msg");
|
|
181
181
|
* ```
|
|
182
182
|
*/
|
|
183
183
|
declare function emitSync(target: any, eventName: EventIdentifier, ...event: [] | [unknown]): void;
|
|
@@ -185,12 +185,12 @@ declare function emitSync(target: any, eventName: EventIdentifier, ...event: []
|
|
|
185
185
|
* Cleans any event channel created on the given target. Un-registers any event listener.
|
|
186
186
|
* @param target the channel object.
|
|
187
187
|
* @example
|
|
188
|
-
* ```
|
|
188
|
+
* ```ts
|
|
189
189
|
* // object as event channel
|
|
190
|
-
*
|
|
190
|
+
* const channel = {};
|
|
191
191
|
*
|
|
192
192
|
* // connect to event "changed"
|
|
193
|
-
* on(channel,"changed",(msg)=> console.log(msg));
|
|
193
|
+
* on(channel, "changed", (msg)=> console.log(msg));
|
|
194
194
|
*
|
|
195
195
|
* // clean channel
|
|
196
196
|
* cleanup(channel);
|
|
@@ -267,14 +267,16 @@ declare const Evented: EventedConstructor;
|
|
|
267
267
|
* @param Base class to inherit from.
|
|
268
268
|
* @returns class which inherits from `Base`.
|
|
269
269
|
* @example
|
|
270
|
-
* ```
|
|
270
|
+
* ```ts
|
|
271
271
|
* import { EventedMixin } from "apprt-core/Events";
|
|
272
272
|
*
|
|
273
273
|
* const MyClass = EventedMixin(class {
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
274
|
+
* trigger() {
|
|
275
|
+
* (this as any).emit("changed", true);
|
|
276
|
+
* }
|
|
277
277
|
* });
|
|
278
|
+
* const myClassInstance = new MyClass();
|
|
279
|
+
* myClassInstance.trigger();
|
|
278
280
|
* ```
|
|
279
281
|
*/
|
|
280
282
|
declare function EventedMixin<BaseType extends Constructor<any, any>>(Base: BaseType): Constructor<InstanceType<BaseType> & Evented<any>, ConstructorParameters<BaseType>>;
|
|
@@ -17,15 +17,15 @@ interface BaseExceptionConstructor<ExceptionType, AllowedNames> {
|
|
|
17
17
|
* Note: This should only be used by custom Exception classes. It is exported as extra name!
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
|
-
* ```
|
|
20
|
+
* ```ts
|
|
21
21
|
* import {default as Exception, registerTypes} from "apprt-core/Exception";
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
23
|
+
* // register new exception type
|
|
24
|
+
* registerTypes(Exception, "ILLEGAL_STATE_ERROR");
|
|
25
|
+
* // now clients can invoke
|
|
26
|
+
* const e = Exception.illegalStateError("error message");
|
|
27
|
+
* e.name === 'ILLEGAL_STATE_ERROR';
|
|
28
|
+
* e.message === "error message";
|
|
29
29
|
* ```
|
|
30
30
|
* @param exceptionConstructor the exception constructor.
|
|
31
31
|
* @param names the exception names to register.
|
|
@@ -56,7 +56,7 @@ interface Exception extends Error {
|
|
|
56
56
|
/**
|
|
57
57
|
* An Exception is a special error class to allow trees of causes.
|
|
58
58
|
* @example
|
|
59
|
-
* ```
|
|
59
|
+
* ```ts
|
|
60
60
|
* import Exception from "apprt-core/Exception";
|
|
61
61
|
*
|
|
62
62
|
* try {
|
|
@@ -77,7 +77,7 @@ interface ExceptionConstructor extends BaseExceptionConstructor<Exception, typeo
|
|
|
77
77
|
* @param error the error
|
|
78
78
|
* @param msg the error message
|
|
79
79
|
* @example
|
|
80
|
-
* ```
|
|
80
|
+
* ```ts
|
|
81
81
|
* import Exception from "apprt-core/Exception";
|
|
82
82
|
*
|
|
83
83
|
* try {
|
package/apprt-core/Logger.d.ts
CHANGED
|
@@ -14,14 +14,14 @@ type LogLevel = "DEBUG" | "INFO" | "WARN" | "ERROR" | "OFF";
|
|
|
14
14
|
* [org.slf4j.Logger API](https://www.javadoc.io/doc/org.slf4j/slf4j-api/1.7.22/org/slf4j/Logger.html).
|
|
15
15
|
*
|
|
16
16
|
* @example <caption>Log debug message</caption>
|
|
17
|
-
* ```
|
|
17
|
+
* ```ts
|
|
18
18
|
* import { loggerForName } from "apprt-core/Logger";
|
|
19
19
|
* const LOG = loggerForName("mybundle/MyFile");
|
|
20
20
|
* LOG.debug("Component started");
|
|
21
21
|
* ```
|
|
22
22
|
*
|
|
23
23
|
* @example <caption>Use placeholders</caption>
|
|
24
|
-
* ```
|
|
24
|
+
* ```ts
|
|
25
25
|
* import { loggerForName } from "apprt-core/Logger";
|
|
26
26
|
* const LOG = loggerForName("mybundle/MyFile");
|
|
27
27
|
* const name = "Xyz";
|
|
@@ -30,7 +30,7 @@ type LogLevel = "DEBUG" | "INFO" | "WARN" | "ERROR" | "OFF";
|
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
32
|
* @example <caption>Test wether log level is enabled</caption>
|
|
33
|
-
* ```
|
|
33
|
+
* ```ts
|
|
34
34
|
* import { loggerForName } from "apprt-core/Logger";
|
|
35
35
|
* const LOG = loggerForName("mybundle/MyFile");
|
|
36
36
|
*
|
|
@@ -40,7 +40,7 @@ type LogLevel = "DEBUG" | "INFO" | "WARN" | "ERROR" | "OFF";
|
|
|
40
40
|
* ```
|
|
41
41
|
*
|
|
42
42
|
* @example <caption>Log prefixed messages</caption>
|
|
43
|
-
* ```
|
|
43
|
+
* ```ts
|
|
44
44
|
* import { loggerForName } from "apprt-core/Logger";
|
|
45
45
|
* const LOG = loggerForName("mybundle/MyFile");
|
|
46
46
|
* const LOGWithPrefix = LOG.withPrefix("[my prefix]");
|
|
@@ -135,7 +135,7 @@ interface Logger {
|
|
|
135
135
|
* Creates a new Logger, which will prefix each log message with the given prefix.
|
|
136
136
|
*
|
|
137
137
|
* @example <caption>Log prefixed messages</caption>
|
|
138
|
-
* ```
|
|
138
|
+
* ```ts
|
|
139
139
|
* const LOG = loggerForName("mybundle/MyFile");
|
|
140
140
|
* const LOGWithPrefix = LOG.withPrefix("[my prefix]");
|
|
141
141
|
* LOGWithPrefix.info("My Message");
|
|
@@ -152,7 +152,7 @@ interface Logger {
|
|
|
152
152
|
* @returns a logger instance. Returns the same logger instance for an equal logger name.
|
|
153
153
|
*
|
|
154
154
|
* @example <caption>Logger usage</caption>
|
|
155
|
-
* ```
|
|
155
|
+
* ```ts
|
|
156
156
|
* import { loggerForName } from "apprt-core/Logger";
|
|
157
157
|
* const LOG = loggerForName("mybundle/MyFile");
|
|
158
158
|
* LOG.info("Component started");
|
|
@@ -166,7 +166,7 @@ declare function loggerForName(name: string): Logger;
|
|
|
166
166
|
* @param level the new level of the logger.
|
|
167
167
|
*
|
|
168
168
|
* @example <caption>Samples</caption>
|
|
169
|
-
* ```
|
|
169
|
+
* ```ts
|
|
170
170
|
* import {setLogLevel} from "apprt-core/Logger";
|
|
171
171
|
* // Changes the root level to DEBUG
|
|
172
172
|
* // All loggers without special configuration will now output messages.
|
package/apprt-core/Mutable.d.ts
CHANGED
|
@@ -170,18 +170,18 @@ declare const Mutable: MutableConstructor<any>;
|
|
|
170
170
|
*
|
|
171
171
|
* @param definition an object with a class specification.
|
|
172
172
|
* @example
|
|
173
|
-
* ```
|
|
174
|
-
*
|
|
173
|
+
* ```ts
|
|
174
|
+
* const Clazz = declare({
|
|
175
175
|
* firstName: "",
|
|
176
176
|
* lastName: "",
|
|
177
177
|
* fullName: {
|
|
178
178
|
* depends: ["firstName", "lastName"],
|
|
179
|
-
* get() {
|
|
179
|
+
* get(): string {
|
|
180
180
|
* return `${this.firstName} ${this.lastName}`;
|
|
181
181
|
* }
|
|
182
182
|
* }
|
|
183
183
|
* });
|
|
184
|
-
*
|
|
184
|
+
* const x = new Clazz();
|
|
185
185
|
* ```
|
|
186
186
|
*/
|
|
187
187
|
declare function declare<Def extends MutableDefinition<any>>(definition: Def & {
|
|
@@ -191,18 +191,18 @@ declare function declare<Def extends MutableDefinition<any>>(definition: Def & {
|
|
|
191
191
|
* Helper to declare Mutable classes from a specification. This is also the default export.
|
|
192
192
|
* @param definition an object with a class specification.
|
|
193
193
|
* @example
|
|
194
|
-
* ```
|
|
195
|
-
*
|
|
194
|
+
* ```ts
|
|
195
|
+
* const Clazz = declare({
|
|
196
196
|
* firstName: "",
|
|
197
197
|
* lastName: "",
|
|
198
198
|
* fullName: {
|
|
199
199
|
* depends: ["firstName", "lastName"],
|
|
200
|
-
* get() {
|
|
200
|
+
* get(): string {
|
|
201
201
|
* return `${this.firstName} ${this.lastName}`;
|
|
202
202
|
* }
|
|
203
203
|
* }
|
|
204
204
|
* });
|
|
205
|
-
*
|
|
205
|
+
* const x = new Clazz();
|
|
206
206
|
* ```
|
|
207
207
|
*/
|
|
208
208
|
declare function declare<Def extends MutableDefinition<any>>(definition: Def & ThisType<Mutable<BuildMutableMembers<Def>>>): MutableConstructor<BuildMutableMembers<Def>>;
|
|
@@ -212,26 +212,26 @@ declare function declare<Def extends MutableDefinition<any>>(definition: Def & T
|
|
|
212
212
|
* @param instance the instance which property.
|
|
213
213
|
* @param name the name of the changed property.
|
|
214
214
|
* @example
|
|
215
|
-
* ```
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
215
|
+
* ```ts
|
|
216
|
+
* import {declare, notifyChange} from "apprt-core/Mutable";
|
|
217
|
+
* let globalCounter = 0;
|
|
218
|
+
* const Clazz = declare({
|
|
219
|
+
* counter: {
|
|
220
|
+
* get() {
|
|
221
|
+
* return globalCounter;
|
|
222
|
+
* }
|
|
223
|
+
* }
|
|
224
224
|
* });
|
|
225
225
|
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
226
|
+
* const instance = new Clazz();
|
|
227
|
+
* instance.watch("counter", ({ value }) => {
|
|
228
|
+
* console.log(`count: ${value}`);
|
|
229
|
+
* });
|
|
230
230
|
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
231
|
+
* // ensure that external counter can be watched
|
|
232
|
+
* globalCounter++;
|
|
233
|
+
* notifyChange(instance, "counter");
|
|
234
|
+
* //-> count: 1
|
|
235
235
|
* ```
|
|
236
236
|
*/
|
|
237
237
|
declare function notifyChange<M extends Mutable<any>>(instance: M, name: PropertyName<M>): void;
|
|
@@ -241,15 +241,13 @@ declare function notifyChange<M extends Mutable<any>>(instance: M, name: Propert
|
|
|
241
241
|
* @param skipOwn skip additional object property names that were not part of the original `declare()`.
|
|
242
242
|
* @returns property names
|
|
243
243
|
* @example
|
|
244
|
-
* ```
|
|
245
|
-
*
|
|
244
|
+
* ```ts
|
|
245
|
+
* const Clazz = declare({
|
|
246
246
|
* firstName: "",
|
|
247
|
-
* lastName: ""
|
|
247
|
+
* lastName: ""
|
|
248
248
|
* });
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
* let names = propertyNames(instance);
|
|
249
|
+
* const instance = new Clazz();
|
|
250
|
+
* const names = propertyNames(instance);
|
|
253
251
|
* //-> names === ["firstName","lastName"]
|
|
254
252
|
* ```
|
|
255
253
|
*/
|
|
@@ -260,15 +258,13 @@ declare function propertyNames(instance: Mutable<any>, skipOwn?: boolean): strin
|
|
|
260
258
|
* @param instance the instance to introspect.
|
|
261
259
|
* @returns values of all properties;
|
|
262
260
|
* @example
|
|
263
|
-
* ```
|
|
264
|
-
*
|
|
261
|
+
* ```ts
|
|
262
|
+
* const Clazz = declare({
|
|
265
263
|
* firstName: "",
|
|
266
|
-
* lastName: ""
|
|
264
|
+
* lastName: ""
|
|
267
265
|
* });
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
* let state = toObject(instance);
|
|
266
|
+
* const instance = new Clazz({firstName:"Test"});
|
|
267
|
+
* const state = toObject(instance);
|
|
272
268
|
* //-> { firstName: "Test", lastName:"" }
|
|
273
269
|
* ```
|
|
274
270
|
*/
|
|
@@ -6,11 +6,11 @@ declare global {
|
|
|
6
6
|
*
|
|
7
7
|
* @deprecated the observable proposal is 'dead'
|
|
8
8
|
* @example
|
|
9
|
-
* ```
|
|
9
|
+
* ```ts
|
|
10
10
|
* // create observable, which ticks all 100 msec
|
|
11
|
-
*
|
|
11
|
+
* const observable = new Observable((observer: any) => {
|
|
12
12
|
* let counter = 0;
|
|
13
|
-
*
|
|
13
|
+
* const t = setInterval(() => {
|
|
14
14
|
* observer.next(++counter);
|
|
15
15
|
* }, 100);
|
|
16
16
|
* // return a cleanup function, is called if subscriber unsubscribes
|
|
@@ -18,10 +18,12 @@ declare global {
|
|
|
18
18
|
* clearInterval(t);
|
|
19
19
|
* };
|
|
20
20
|
* });
|
|
21
|
-
*
|
|
22
21
|
* // now somebody can subscribe
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* const subscription = observable.subscribe({
|
|
23
|
+
* next(value: number) {
|
|
24
|
+
* console.debug(value);
|
|
25
|
+
* }
|
|
26
|
+
* });
|
|
25
27
|
* // to unlink do:
|
|
26
28
|
* subscription.unsubscribe();
|
|
27
29
|
* ```
|
|
@@ -121,66 +121,72 @@ interface ObserverOptions {
|
|
|
121
121
|
* @param options optional parameters to customize the creation
|
|
122
122
|
*
|
|
123
123
|
* @example _track a event connection_
|
|
124
|
-
* ```
|
|
124
|
+
* ```ts
|
|
125
125
|
* import Observers from "apprt-core/Observers";
|
|
126
|
-
*
|
|
127
|
-
* let observers = Observers();
|
|
128
|
-
* // track connection to eventSource
|
|
129
|
-
* observers.add(eventSource.on("event", ()=>{...}));
|
|
126
|
+
* import { Evented } from "apprt-core/Events";
|
|
130
127
|
*
|
|
128
|
+
* const eventSource = new Evented();
|
|
129
|
+
* const observers = Observers();
|
|
130
|
+
* // track connection to eventSource
|
|
131
|
+
* observers.add(eventSource.on("event", ()=>{ ... }));
|
|
131
132
|
* // if the connection needs to be cleaned call
|
|
132
133
|
* observers.clean();
|
|
133
134
|
* ```
|
|
134
135
|
*
|
|
135
136
|
* @example _group event connections_
|
|
136
|
-
* ```
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* let observers = Observers();
|
|
137
|
+
* ```ts
|
|
138
|
+
* const eventSourceA = new Evented();
|
|
139
|
+
* const eventSourceB = new Evented();
|
|
140
|
+
* const observers = Observers();
|
|
141
141
|
* // track connection to eventSourceA, but in group "a"
|
|
142
142
|
* observers.group("a").add(eventSourceA.on("event", ()=>{ ... }));
|
|
143
143
|
* // track connection to eventSourceB, but in group "b"
|
|
144
144
|
* observers.group("b").add(eventSourceB.on("event", ()=>{ ... }));
|
|
145
|
-
*
|
|
146
145
|
* // if "a" is not longer required
|
|
147
146
|
* observers.group("a").clean();
|
|
148
|
-
*
|
|
149
147
|
* // if "b" is not longer required (shows alternative)
|
|
150
148
|
* observers.clean("b");
|
|
151
|
-
*
|
|
152
149
|
* // if none of the connections are required anymore clean all
|
|
153
150
|
* observers.clean();
|
|
154
151
|
* ```
|
|
155
152
|
*
|
|
156
153
|
* @example _use the rebind functionality_
|
|
157
|
-
* ```
|
|
154
|
+
* ```ts
|
|
158
155
|
* // The bind/rebind functionality helps to encapsulate the code to connect to an observable.
|
|
159
156
|
* // When the observable target changes a simple call to 'bind'
|
|
160
157
|
* // rexecutes the connection code and clears the old connection.
|
|
161
158
|
*
|
|
162
|
-
* import Observers from "apprt-core/Observers";
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
159
|
+
* import createObservers, { Observers } from "apprt-core/Observers";
|
|
160
|
+
* import { Evented } from "apprt-core/Events";
|
|
161
|
+
*
|
|
162
|
+
* interface CustomEvents {
|
|
163
|
+
* "changed": boolean
|
|
164
|
+
* }
|
|
165
|
+
*
|
|
166
|
+
* class Controller {
|
|
167
|
+
* private observers: Observers | undefined;
|
|
168
|
+
* private events: any[] = [];
|
|
169
|
+
* constructor() {
|
|
170
|
+
* this.events = [];
|
|
171
|
+
* this.observers = createObservers({
|
|
172
|
+
* // rebind is executed if Observers.bind is called, and used to reconnect to a new source instance
|
|
173
|
+
* rebind: (observers, source) => {
|
|
174
|
+
* const eventSource = source as Evented<CustomEvents>;
|
|
175
|
+
* observers.add(eventSource.on("change", (evt) => {
|
|
176
|
+
* this.events.push(evt);
|
|
177
|
+
* }));
|
|
178
|
+
* }
|
|
179
|
+
* });
|
|
180
|
+
* }
|
|
181
|
+
* connect(eventSource: Evented<CustomEvents>) {
|
|
176
182
|
* // observe new event source
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
183
|
+
* this.observers!.bind(eventSource);
|
|
184
|
+
* }
|
|
185
|
+
* disconnect() {
|
|
180
186
|
* // disconnect from event source
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
187
|
+
* this.observers!.clean();
|
|
188
|
+
* }
|
|
189
|
+
* }
|
|
184
190
|
* ```
|
|
185
191
|
*/
|
|
186
192
|
declare function createObservers(options?: ObserverOptions): Observers;
|
package/apprt-core/Promise.d.ts
CHANGED
|
@@ -29,8 +29,8 @@ declare class ExtendedPromise<T> implements Promise<T> {
|
|
|
29
29
|
* Creates Promise instances.
|
|
30
30
|
* @param executor defined as (resolve,reject)=> \{\}
|
|
31
31
|
* @example
|
|
32
|
-
* ```
|
|
33
|
-
* new Promise((resolve,reject)=>{
|
|
32
|
+
* ```ts
|
|
33
|
+
* new Promise((resolve, reject)=>{
|
|
34
34
|
* ...
|
|
35
35
|
* });
|
|
36
36
|
* ```
|
|
@@ -98,7 +98,7 @@ declare class ExtendedPromise<T> implements Promise<T> {
|
|
|
98
98
|
* Allows to resolve/reject the promise manually after creating it.
|
|
99
99
|
*
|
|
100
100
|
* @example
|
|
101
|
-
* ```
|
|
101
|
+
* ```ts
|
|
102
102
|
* const { promise, resolve, reject } = Promise.withResolvers();
|
|
103
103
|
* ```
|
|
104
104
|
* @returns {{ promise, resolve, reject }}
|
|
@@ -19,10 +19,10 @@ interface Task {
|
|
|
19
19
|
* Implementation hint: Pushed task are queued and executed as micro tasks in the next event queue slot.
|
|
20
20
|
*
|
|
21
21
|
* @example _Use default export_
|
|
22
|
-
* ```
|
|
22
|
+
* ```ts
|
|
23
23
|
* import TaskExecutor from "apprt-core/TaskExecutor";
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* const executor = new TaskExecutor();
|
|
25
|
+
* const task = function(){ doSomething(); };
|
|
26
26
|
* // execute the task as fast as possible
|
|
27
27
|
* executor.push(task);
|
|
28
28
|
* // add again (will drop the old add, as long as the task was not executed)
|