@akylas/nativescript 8.4.7 → 8.4.9
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/abortcontroller/abortsignal.js +5 -5
- package/abortcontroller/abortsignal.js.map +1 -1
- package/accessibility/accessibility-common.d.ts +1 -1
- package/accessibility/accessibility-common.js.map +1 -1
- package/accessibility/accessibility-properties.js +5 -13
- package/accessibility/accessibility-properties.js.map +1 -1
- package/accessibility/font-scale.android.js.map +1 -1
- package/accessibility/index.android.d.ts +2 -2
- package/accessibility/index.android.js.map +1 -1
- package/accessibility/index.d.ts +1 -1
- package/animation-frame/animation-native.ios.d.ts +1 -1
- package/application/application-common.d.ts +5 -4
- package/application/application-common.js +5 -5
- package/application/application-common.js.map +1 -1
- package/application/application-interfaces.d.ts +27 -5
- package/application/index.android.d.ts +12 -12
- package/application/index.android.js.map +1 -1
- package/application/index.d.ts +30 -35
- package/application/index.ios.d.ts +1 -0
- package/application/index.ios.js +23 -28
- package/application/index.ios.js.map +1 -1
- package/core-types/index.d.ts +10 -10
- package/css/CSS3Parser.d.ts +3 -3
- package/css/parser.d.ts +17 -17
- package/data/observable/index.d.ts +133 -17
- package/data/observable/index.js +192 -4
- package/data/observable/index.js.map +1 -1
- package/file-system/file-system-access.android.d.ts +13 -0
- package/file-system/file-system-access.android.js +141 -0
- package/file-system/file-system-access.android.js.map +1 -1
- package/file-system/file-system-access.d.ts +12 -0
- package/file-system/file-system-access.ios.d.ts +7 -0
- package/file-system/file-system-access.ios.js +56 -0
- package/file-system/file-system-access.ios.js.map +1 -1
- package/fps-meter/fps-native.android.js.map +1 -1
- package/global-types.d.ts +93 -104
- package/globals/index.js.map +1 -1
- package/http/index.d.ts +1 -1
- package/image-source/index.android.js +5 -5
- package/image-source/index.android.js.map +1 -1
- package/image-source/index.ios.js +5 -5
- package/image-source/index.ios.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/module-name-resolver/index.d.ts +1 -1
- package/package.json +1 -1
- package/platform/index.android.d.ts +2 -2
- package/platform/index.ios.d.ts +2 -2
- package/platforms/android/widgets-release.aar +0 -0
- package/profiling/index.d.ts +3 -3
- package/profiling/index.js +1 -1
- package/profiling/index.js.map +1 -1
- package/ui/action-bar/action-bar-common.js +4 -4
- package/ui/action-bar/action-bar-common.js.map +1 -1
- package/ui/action-bar/index.d.ts +2 -2
- package/ui/animation/animation-interfaces.d.ts +4 -4
- package/ui/animation/index.ios.js +3 -3
- package/ui/animation/index.ios.js.map +1 -1
- package/ui/builder/component-builder/index.js +40 -38
- package/ui/builder/component-builder/index.js.map +1 -1
- package/ui/builder/xml2ui.js +3 -3
- package/ui/builder/xml2ui.js.map +1 -1
- package/ui/button/index.d.ts +2 -4
- package/ui/core/properties/index.d.ts +1 -0
- package/ui/core/properties/index.js +19 -6
- package/ui/core/properties/index.js.map +1 -1
- package/ui/core/view/index.android.d.ts +1 -1
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/index.ios.js +3 -1
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/view-common.d.ts +1 -1
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.d.ts +9 -9
- package/ui/core/view/view-helper/index.ios.d.ts +2 -0
- package/ui/core/view/view-helper/index.ios.js +95 -40
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/weak-event-listener/index.js.map +1 -1
- package/ui/dialogs/dialogs-common.js +1 -0
- package/ui/dialogs/dialogs-common.js.map +1 -1
- package/ui/dialogs/index.android.js +7 -9
- package/ui/dialogs/index.android.js.map +1 -1
- package/ui/editable-text-base/editable-text-base-common.js +1 -2
- package/ui/editable-text-base/editable-text-base-common.js.map +1 -1
- package/ui/editable-text-base/index.android.js +2 -7
- package/ui/editable-text-base/index.android.js.map +1 -1
- package/ui/frame/frame-common.d.ts +6 -0
- package/ui/frame/frame-common.js +3 -2
- package/ui/frame/frame-common.js.map +1 -1
- package/ui/frame/index.android.js +8 -6
- package/ui/frame/index.android.js.map +1 -1
- package/ui/frame/index.d.ts +3 -3
- package/ui/gestures/gestures-common.js +5 -5
- package/ui/gestures/gestures-common.js.map +1 -1
- package/ui/gestures/index.android.js +3 -3
- package/ui/gestures/index.android.js.map +1 -1
- package/ui/gestures/index.d.ts +2 -2
- package/ui/gestures/index.ios.js +6 -6
- package/ui/gestures/index.ios.js.map +1 -1
- package/ui/gestures/touch-manager.d.ts +2 -2
- package/ui/image-cache/image-cache-common.d.ts +5 -5
- package/ui/image-cache/image-cache-common.js +2 -2
- package/ui/image-cache/image-cache-common.js.map +1 -1
- package/ui/image-cache/index.d.ts +3 -3
- package/ui/label/index.android.js +1 -0
- package/ui/label/index.android.js.map +1 -1
- package/ui/layouts/flexbox-layout/flexbox-layout-common.d.ts +12 -12
- package/ui/layouts/grid-layout/grid-layout-common.d.ts +1 -1
- package/ui/layouts/root-layout/root-layout-common.js +45 -36
- package/ui/layouts/root-layout/root-layout-common.js.map +1 -1
- package/ui/list-view/index.d.ts +6 -6
- package/ui/list-view/list-view-common.js +8 -2
- package/ui/list-view/list-view-common.js.map +1 -1
- package/ui/page/index.ios.d.ts +1 -6
- package/ui/page/index.ios.js +96 -78
- package/ui/page/index.ios.js.map +1 -1
- package/ui/page/page-common.d.ts +1 -1
- package/ui/page/page-common.js.map +1 -1
- package/ui/placeholder/index.android.d.ts +2 -2
- package/ui/placeholder/index.d.ts +2 -2
- package/ui/repeater/index.js +2 -1
- package/ui/repeater/index.js.map +1 -1
- package/ui/scroll-view/scroll-view-common.d.ts +4 -4
- package/ui/scroll-view/scroll-view-common.js.map +1 -1
- package/ui/search-bar/index.d.ts +3 -3
- package/ui/segmented-bar/index.d.ts +2 -2
- package/ui/segmented-bar/segmented-bar-common.d.ts +2 -2
- package/ui/styling/background.ios.js +3 -0
- package/ui/styling/background.ios.js.map +1 -1
- package/ui/styling/css-animation-parser.d.ts +8 -0
- package/ui/styling/css-animation-parser.js +90 -36
- package/ui/styling/css-animation-parser.js.map +1 -1
- package/ui/styling/css-selector.d.ts +1 -1
- package/ui/styling/css-utils.d.ts +1 -0
- package/ui/styling/css-utils.js +12 -0
- package/ui/styling/css-utils.js.map +1 -0
- package/ui/styling/font-common.js +6 -6
- package/ui/styling/font-common.js.map +1 -1
- package/ui/styling/font-interfaces.d.ts +3 -3
- package/ui/styling/font.ios.js +2 -1
- package/ui/styling/font.ios.js.map +1 -1
- package/ui/styling/style/index.d.ts +3 -0
- package/ui/styling/style/index.js.map +1 -1
- package/ui/styling/style-properties.js +5 -13
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/styling/style-scope.js +7 -5
- package/ui/styling/style-scope.js.map +1 -1
- package/ui/tab-view/index.d.ts +2 -2
- package/ui/tab-view/tab-view-common.d.ts +2 -2
- package/ui/text-base/index.ios.js +21 -4
- package/ui/text-base/index.ios.js.map +1 -1
- package/ui/text-base/span.d.ts +1 -1
- package/ui/text-base/span.js.map +1 -1
- package/ui/web-view/index.d.ts +3 -3
- package/ui/web-view/web-view-interfaces.d.ts +1 -1
- package/utils/index.d.ts +0 -82
- package/utils/mainthread-helper.android.js +2 -2
- package/utils/mainthread-helper.android.js.map +1 -1
- package/utils/typescript-utils.d.ts +6 -0
- package/xhr/index.js +28 -28
- package/xhr/index.js.map +1 -1
- package/xml/index.js.map +1 -1
|
@@ -1,46 +1,162 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Optional } from '../../utils/typescript-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Base event data.
|
|
4
|
+
*/
|
|
2
5
|
export interface EventData {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the event.
|
|
8
|
+
*/
|
|
3
9
|
eventName: string;
|
|
4
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The Observable instance that has raised the event.
|
|
12
|
+
*/
|
|
13
|
+
object: Observable;
|
|
5
14
|
}
|
|
6
15
|
export interface EventDataValue extends EventData {
|
|
7
16
|
value?: boolean;
|
|
8
17
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* Data for the "propertyChange" event.
|
|
20
|
+
*/
|
|
13
21
|
export interface PropertyChangeData extends EventData {
|
|
22
|
+
/**
|
|
23
|
+
* The name of the property that has changed.
|
|
24
|
+
*/
|
|
14
25
|
propertyName: string;
|
|
26
|
+
/**
|
|
27
|
+
* The new value of the property.
|
|
28
|
+
*/
|
|
15
29
|
value: any;
|
|
30
|
+
/**
|
|
31
|
+
* The previous value of the property.
|
|
32
|
+
*/
|
|
16
33
|
oldValue?: any;
|
|
17
34
|
}
|
|
18
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Helper class that is used to fire property change even when real object is the same.
|
|
37
|
+
* By default property change will not be fired for a same object.
|
|
38
|
+
* By wrapping object into a WrappedValue instance `same object restriction` will be passed.
|
|
39
|
+
*/
|
|
40
|
+
export declare class WrappedValue {
|
|
41
|
+
/**
|
|
42
|
+
* Property which holds the real value.
|
|
43
|
+
*/
|
|
19
44
|
wrapped: any;
|
|
20
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Creates an instance of WrappedValue object.
|
|
47
|
+
* @param wrapped - the real value which should be wrapped.
|
|
48
|
+
*/
|
|
49
|
+
constructor(
|
|
50
|
+
/**
|
|
51
|
+
* Property which holds the real value.
|
|
52
|
+
*/
|
|
53
|
+
wrapped: any);
|
|
54
|
+
/**
|
|
55
|
+
* Gets the real value of previously wrappedValue.
|
|
56
|
+
* @param value - Value that should be unwraped. If there is no wrappedValue property of the value object then value will be returned.
|
|
57
|
+
*/
|
|
21
58
|
static unwrap(value: any): any;
|
|
59
|
+
/**
|
|
60
|
+
* Returns an instance of WrappedValue. The actual instance is get from a WrappedValues pool.
|
|
61
|
+
* @param value - Value that should be wrapped.
|
|
62
|
+
*/
|
|
22
63
|
static wrap(value: any): any;
|
|
23
64
|
}
|
|
24
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Observable is used when you want to be notified when a change occurs. Use on/off methods to add/remove listener.
|
|
67
|
+
* Please note that should you be using the `new Observable({})` constructor, it is **obsolete** since v3.0,
|
|
68
|
+
* and you have to migrate to the "data/observable" `fromObject({})` or the `fromObjectRecursive({})` functions.
|
|
69
|
+
*/
|
|
70
|
+
export declare class Observable {
|
|
71
|
+
/**
|
|
72
|
+
* String value used when hooking to propertyChange event.
|
|
73
|
+
*/
|
|
25
74
|
static propertyChangeEvent: string;
|
|
75
|
+
/**
|
|
76
|
+
* Alternative to `instanceof ViewBase`.
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
26
79
|
_isViewBase: boolean;
|
|
27
|
-
private _observers;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
80
|
+
private readonly _observers;
|
|
81
|
+
/**
|
|
82
|
+
* Adds one-time listener function for the event named `event`.
|
|
83
|
+
* @param event Name of the event to attach to.
|
|
84
|
+
* @param callback A function to be called when the specified event is raised.
|
|
85
|
+
* @param thisArg An optional parameter which when set will be used as "this" in callback method call.
|
|
86
|
+
*/
|
|
32
87
|
once(event: string, callback: (data: EventData) => void, thisArg?: any): void;
|
|
33
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Shortcut alias to the removeEventListener method.
|
|
90
|
+
*/
|
|
91
|
+
off(eventNames: string, callback?: (data: EventData) => void, thisArg?: any): void;
|
|
92
|
+
/**
|
|
93
|
+
* Adds a listener for the specified event name.
|
|
94
|
+
* @param eventNames Comma delimited names of the events to attach the listener to.
|
|
95
|
+
* @param callback A function to be called when some of the specified event(s) is raised.
|
|
96
|
+
* @param thisArg An optional parameter which when set will be used as "this" in callback method call.
|
|
97
|
+
*/
|
|
34
98
|
addEventListener(eventNames: string, callback: (data: EventData) => void, thisArg?: any): void;
|
|
35
|
-
|
|
36
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Removes listener(s) for the specified event name.
|
|
101
|
+
* @param eventNames Comma delimited names of the events the specified listener is associated with.
|
|
102
|
+
* @param callback An optional parameter pointing to a specific listener. If not defined, all listeners for the event names will be removed.
|
|
103
|
+
* @param thisArg An optional parameter which when set will be used to refine search of the correct callback which will be removed as event listener.
|
|
104
|
+
*/
|
|
105
|
+
removeEventListener(eventNames: string, callback?: (data: EventData) => void, thisArg?: any): void;
|
|
106
|
+
/**
|
|
107
|
+
* Notify this Observable instance with some data. This causes all event
|
|
108
|
+
* handlers on the Observable instance to be called, as well as any 'global'
|
|
109
|
+
* event handlers set on the instance's class.
|
|
110
|
+
*
|
|
111
|
+
* @param data an object that satisfies the EventData interface, though with
|
|
112
|
+
* an optional 'object' property. If left undefined, the 'object' property
|
|
113
|
+
* will implicitly be set as this Observable instance.
|
|
114
|
+
*/
|
|
115
|
+
notify<T extends Optional<EventData, 'object'>>(data: T): void;
|
|
37
116
|
private static _handleEvent;
|
|
117
|
+
/**
|
|
118
|
+
* Notifies all the registered listeners for the property change event.
|
|
119
|
+
*/
|
|
38
120
|
notifyPropertyChange(name: string, value: any, oldValue?: any): void;
|
|
121
|
+
/**
|
|
122
|
+
* Checks whether a listener is registered for the specified event name.
|
|
123
|
+
* @param eventName The name of the event to check for.
|
|
124
|
+
*/
|
|
39
125
|
hasListeners(eventName: string): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* This method is intended to be overriden by inheritors to provide additional implementation.
|
|
128
|
+
*/
|
|
40
129
|
_createPropertyChangeData(propertyName: string, value: any, oldValue?: any): PropertyChangeData;
|
|
41
130
|
_emit(eventNames: string): void;
|
|
42
131
|
private _getEventList;
|
|
43
132
|
private static _indexOfListener;
|
|
44
133
|
}
|
|
134
|
+
export interface Observable {
|
|
135
|
+
/**
|
|
136
|
+
* Raised when a propertyChange occurs.
|
|
137
|
+
*/
|
|
138
|
+
on(event: 'propertyChange', callback: (data: EventData) => void, thisArg?: any): void;
|
|
139
|
+
/**
|
|
140
|
+
* Updates the specified property with the provided value.
|
|
141
|
+
*/
|
|
142
|
+
set(name: string, value: any): void;
|
|
143
|
+
/**
|
|
144
|
+
* Updates the specified property with the provided value and raises a property change event and a specific change event based on the property name.
|
|
145
|
+
*/
|
|
146
|
+
setProperty(name: string, value: any): void;
|
|
147
|
+
/**
|
|
148
|
+
* Gets the value of the specified property.
|
|
149
|
+
*/
|
|
150
|
+
get(name: string): any;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Creates an Observable instance and sets its properties according to the supplied JavaScript object.
|
|
154
|
+
* param obj - A JavaScript object used to initialize nativescript Observable instance.
|
|
155
|
+
*/
|
|
45
156
|
export declare function fromObject(source: any): Observable;
|
|
157
|
+
/**
|
|
158
|
+
* Creates an Observable instance and sets its properties according to the supplied JavaScript object.
|
|
159
|
+
* This function will create new Observable for each nested object (expect arrays and functions) from supplied JavaScript object.
|
|
160
|
+
* param obj - A JavaScript object used to initialize nativescript Observable instance.
|
|
161
|
+
*/
|
|
46
162
|
export declare function fromObjectRecursive(source: any): Observable;
|
package/data/observable/index.js
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
let _wrappedIndex = 0;
|
|
2
|
+
/**
|
|
3
|
+
* Helper class that is used to fire property change even when real object is the same.
|
|
4
|
+
* By default property change will not be fired for a same object.
|
|
5
|
+
* By wrapping object into a WrappedValue instance `same object restriction` will be passed.
|
|
6
|
+
*/
|
|
2
7
|
export class WrappedValue {
|
|
3
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of WrappedValue object.
|
|
10
|
+
* @param wrapped - the real value which should be wrapped.
|
|
11
|
+
*/
|
|
12
|
+
constructor(
|
|
13
|
+
/**
|
|
14
|
+
* Property which holds the real value.
|
|
15
|
+
*/
|
|
16
|
+
wrapped) {
|
|
4
17
|
this.wrapped = wrapped;
|
|
5
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Gets the real value of previously wrappedValue.
|
|
21
|
+
* @param value - Value that should be unwraped. If there is no wrappedValue property of the value object then value will be returned.
|
|
22
|
+
*/
|
|
6
23
|
static unwrap(value) {
|
|
7
24
|
return value instanceof WrappedValue ? value.wrapped : value;
|
|
8
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns an instance of WrappedValue. The actual instance is get from a WrappedValues pool.
|
|
28
|
+
* @param value - Value that should be wrapped.
|
|
29
|
+
*/
|
|
9
30
|
static wrap(value) {
|
|
10
31
|
const w = _wrappedValues[_wrappedIndex++ % 5];
|
|
11
32
|
w.wrapped = value;
|
|
@@ -13,6 +34,12 @@ export class WrappedValue {
|
|
|
13
34
|
}
|
|
14
35
|
}
|
|
15
36
|
const _wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)];
|
|
37
|
+
const _globalEventHandlers = {};
|
|
38
|
+
/**
|
|
39
|
+
* Observable is used when you want to be notified when a change occurs. Use on/off methods to add/remove listener.
|
|
40
|
+
* Please note that should you be using the `new Observable({})` constructor, it is **obsolete** since v3.0,
|
|
41
|
+
* and you have to migrate to the "data/observable" `fromObject({})` or the `fromObjectRecursive({})` functions.
|
|
42
|
+
*/
|
|
16
43
|
export class Observable {
|
|
17
44
|
constructor() {
|
|
18
45
|
this._observers = {};
|
|
@@ -44,9 +71,21 @@ export class Observable {
|
|
|
44
71
|
this.notify(eventData);
|
|
45
72
|
}
|
|
46
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
|
|
76
|
+
* @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
|
|
77
|
+
* @param callback - Callback function which will be executed when event is raised.
|
|
78
|
+
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
|
|
79
|
+
*/
|
|
47
80
|
on(eventNames, callback, thisArg) {
|
|
48
81
|
this.addEventListener(eventNames, callback, thisArg);
|
|
49
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Adds one-time listener function for the event named `event`.
|
|
85
|
+
* @param event Name of the event to attach to.
|
|
86
|
+
* @param callback A function to be called when the specified event is raised.
|
|
87
|
+
* @param thisArg An optional parameter which when set will be used as "this" in callback method call.
|
|
88
|
+
*/
|
|
50
89
|
once(event, callback, thisArg) {
|
|
51
90
|
if (typeof event !== 'string') {
|
|
52
91
|
throw new TypeError('Event must be string.');
|
|
@@ -57,9 +96,18 @@ export class Observable {
|
|
|
57
96
|
const list = this._getEventList(event, true);
|
|
58
97
|
list.push({ callback, thisArg, once: true });
|
|
59
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Shortcut alias to the removeEventListener method.
|
|
101
|
+
*/
|
|
60
102
|
off(eventNames, callback, thisArg) {
|
|
61
103
|
this.removeEventListener(eventNames, callback, thisArg);
|
|
62
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Adds a listener for the specified event name.
|
|
107
|
+
* @param eventNames Comma delimited names of the events to attach the listener to.
|
|
108
|
+
* @param callback A function to be called when some of the specified event(s) is raised.
|
|
109
|
+
* @param thisArg An optional parameter which when set will be used as "this" in callback method call.
|
|
110
|
+
*/
|
|
63
111
|
addEventListener(eventNames, callback, thisArg) {
|
|
64
112
|
if (typeof eventNames !== 'string') {
|
|
65
113
|
throw new TypeError('Events name(s) must be string.');
|
|
@@ -78,6 +126,12 @@ export class Observable {
|
|
|
78
126
|
});
|
|
79
127
|
}
|
|
80
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Removes listener(s) for the specified event name.
|
|
131
|
+
* @param eventNames Comma delimited names of the events the specified listener is associated with.
|
|
132
|
+
* @param callback An optional parameter pointing to a specific listener. If not defined, all listeners for the event names will be removed.
|
|
133
|
+
* @param thisArg An optional parameter which when set will be used to refine search of the correct callback which will be removed as event listener.
|
|
134
|
+
*/
|
|
81
135
|
removeEventListener(eventNames, callback, thisArg) {
|
|
82
136
|
if (typeof eventNames !== 'string') {
|
|
83
137
|
throw new TypeError('Events name(s) must be string.');
|
|
@@ -106,13 +160,122 @@ export class Observable {
|
|
|
106
160
|
}
|
|
107
161
|
}
|
|
108
162
|
}
|
|
163
|
+
// public static on(eventName: string, callback: (data: EventData) => void, thisArg?: any): void {
|
|
164
|
+
// this.addEventListener(eventName, callback, thisArg);
|
|
165
|
+
// }
|
|
166
|
+
// public static once(eventName: string, callback: (data: EventData) => void, thisArg?: any): void {
|
|
167
|
+
// if (typeof eventName !== 'string') {
|
|
168
|
+
// throw new TypeError('Event must be string.');
|
|
169
|
+
// }
|
|
170
|
+
// if (typeof callback !== 'function') {
|
|
171
|
+
// throw new TypeError('callback must be function.');
|
|
172
|
+
// }
|
|
173
|
+
// const eventClass = this.name === 'Observable' ? '*' : this.name;
|
|
174
|
+
// if (!_globalEventHandlers[eventClass]) {
|
|
175
|
+
// _globalEventHandlers[eventClass] = {};
|
|
176
|
+
// }
|
|
177
|
+
// if (!Array.isArray(_globalEventHandlers[eventClass][eventName])) {
|
|
178
|
+
// _globalEventHandlers[eventClass][eventName] = [];
|
|
179
|
+
// }
|
|
180
|
+
// _globalEventHandlers[eventClass][eventName].push({ callback, thisArg, once: true });
|
|
181
|
+
// }
|
|
182
|
+
// public static off(eventName: string, callback?: (data: EventData) => void, thisArg?: any): void {
|
|
183
|
+
// this.removeEventListener(eventName, callback, thisArg);
|
|
184
|
+
// }
|
|
185
|
+
// public static removeEventListener(eventName: string, callback?: (data: EventData) => void, thisArg?: any): void {
|
|
186
|
+
// if (typeof eventName !== 'string') {
|
|
187
|
+
// throw new TypeError('Event must be string.');
|
|
188
|
+
// }
|
|
189
|
+
// if (callback && typeof callback !== 'function') {
|
|
190
|
+
// throw new TypeError('callback must be function.');
|
|
191
|
+
// }
|
|
192
|
+
// const eventClass = this.name === 'Observable' ? '*' : this.name;
|
|
193
|
+
// // Short Circuit if no handlers exist..
|
|
194
|
+
// if (!_globalEventHandlers[eventClass] || !Array.isArray(_globalEventHandlers[eventClass][eventName])) {
|
|
195
|
+
// return;
|
|
196
|
+
// }
|
|
197
|
+
// const events = _globalEventHandlers[eventClass][eventName];
|
|
198
|
+
// if (thisArg) {
|
|
199
|
+
// for (let i = 0; i < events.length; i++) {
|
|
200
|
+
// if (events[i].callback === callback && events[i].thisArg === thisArg) {
|
|
201
|
+
// events.splice(i, 1);
|
|
202
|
+
// i--;
|
|
203
|
+
// }
|
|
204
|
+
// }
|
|
205
|
+
// } else if (callback) {
|
|
206
|
+
// for (let i = 0; i < events.length; i++) {
|
|
207
|
+
// if (events[i].callback === callback) {
|
|
208
|
+
// events.splice(i, 1);
|
|
209
|
+
// i--;
|
|
210
|
+
// }
|
|
211
|
+
// }
|
|
212
|
+
// } else {
|
|
213
|
+
// // Clear all events of this type
|
|
214
|
+
// delete _globalEventHandlers[eventClass][eventName];
|
|
215
|
+
// }
|
|
216
|
+
// if (events.length === 0) {
|
|
217
|
+
// // Clear all events of this type
|
|
218
|
+
// delete _globalEventHandlers[eventClass][eventName];
|
|
219
|
+
// }
|
|
220
|
+
// // Clear the primary class grouping if no events are left
|
|
221
|
+
// const keys = Object.keys(_globalEventHandlers[eventClass]);
|
|
222
|
+
// if (keys.length === 0) {
|
|
223
|
+
// delete _globalEventHandlers[eventClass];
|
|
224
|
+
// }
|
|
225
|
+
// }
|
|
226
|
+
// public static addEventListener(eventName: string, callback: (data: EventData) => void, thisArg?: any): void {
|
|
227
|
+
// if (typeof eventName !== 'string') {
|
|
228
|
+
// throw new TypeError('Event must be string.');
|
|
229
|
+
// }
|
|
230
|
+
// if (typeof callback !== 'function') {
|
|
231
|
+
// throw new TypeError('callback must be function.');
|
|
232
|
+
// }
|
|
233
|
+
// const eventClass = this.name === 'Observable' ? '*' : this.name;
|
|
234
|
+
// if (!_globalEventHandlers[eventClass]) {
|
|
235
|
+
// _globalEventHandlers[eventClass] = {};
|
|
236
|
+
// }
|
|
237
|
+
// if (!Array.isArray(_globalEventHandlers[eventClass][eventName])) {
|
|
238
|
+
// _globalEventHandlers[eventClass][eventName] = [];
|
|
239
|
+
// }
|
|
240
|
+
// _globalEventHandlers[eventClass][eventName].push({ callback, thisArg });
|
|
241
|
+
// }
|
|
242
|
+
// private _globalNotify<T extends EventData>(eventClass: string, eventType: string, data: T): void {
|
|
243
|
+
// // Check for the Global handlers for JUST this class
|
|
244
|
+
// if (_globalEventHandlers[eventClass]) {
|
|
245
|
+
// const event = data.eventName + eventType;
|
|
246
|
+
// const events = _globalEventHandlers[eventClass][event];
|
|
247
|
+
// if (events) {
|
|
248
|
+
// Observable._handleEvent(events, data);
|
|
249
|
+
// }
|
|
250
|
+
// }
|
|
251
|
+
// // Check for he Global handlers for ALL classes
|
|
252
|
+
// if (_globalEventHandlers['*']) {
|
|
253
|
+
// const event = data.eventName + eventType;
|
|
254
|
+
// const events = _globalEventHandlers['*'][event];
|
|
255
|
+
// if (events) {
|
|
256
|
+
// Observable._handleEvent(events, data);
|
|
257
|
+
// }
|
|
258
|
+
// }
|
|
259
|
+
// }
|
|
260
|
+
/**
|
|
261
|
+
* Notify this Observable instance with some data. This causes all event
|
|
262
|
+
* handlers on the Observable instance to be called, as well as any 'global'
|
|
263
|
+
* event handlers set on the instance's class.
|
|
264
|
+
*
|
|
265
|
+
* @param data an object that satisfies the EventData interface, though with
|
|
266
|
+
* an optional 'object' property. If left undefined, the 'object' property
|
|
267
|
+
* will implicitly be set as this Observable instance.
|
|
268
|
+
*/
|
|
109
269
|
notify(data) {
|
|
110
|
-
|
|
111
|
-
|
|
270
|
+
data.object = data.object || this;
|
|
271
|
+
const dataWithObject = data;
|
|
272
|
+
const eventClass = this.constructor.name;
|
|
273
|
+
// this._globalNotify(eventClass, 'First', dataWithObject);
|
|
112
274
|
const observers = this._observers[data.eventName];
|
|
113
275
|
if (observers) {
|
|
114
|
-
Observable._handleEvent(observers,
|
|
276
|
+
Observable._handleEvent(observers, dataWithObject);
|
|
115
277
|
}
|
|
278
|
+
// this._globalNotify(eventClass, '', dataWithObject);
|
|
116
279
|
}
|
|
117
280
|
static _handleEvent(observers, data) {
|
|
118
281
|
if (!observers) {
|
|
@@ -140,12 +303,22 @@ export class Observable {
|
|
|
140
303
|
}
|
|
141
304
|
}
|
|
142
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* Notifies all the registered listeners for the property change event.
|
|
308
|
+
*/
|
|
143
309
|
notifyPropertyChange(name, value, oldValue) {
|
|
144
310
|
this.notify(this._createPropertyChangeData(name, value, oldValue));
|
|
145
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Checks whether a listener is registered for the specified event name.
|
|
314
|
+
* @param eventName The name of the event to check for.
|
|
315
|
+
*/
|
|
146
316
|
hasListeners(eventName) {
|
|
147
317
|
return eventName in this._observers;
|
|
148
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* This method is intended to be overriden by inheritors to provide additional implementation.
|
|
321
|
+
*/
|
|
149
322
|
_createPropertyChangeData(propertyName, value, oldValue) {
|
|
150
323
|
return {
|
|
151
324
|
eventName: Observable.propertyChangeEvent,
|
|
@@ -190,6 +363,9 @@ export class Observable {
|
|
|
190
363
|
return -1;
|
|
191
364
|
}
|
|
192
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* String value used when hooking to propertyChange event.
|
|
368
|
+
*/
|
|
193
369
|
Observable.propertyChangeEvent = 'propertyChange';
|
|
194
370
|
class ObservableFromObject extends Observable {
|
|
195
371
|
constructor() {
|
|
@@ -199,6 +375,9 @@ class ObservableFromObject extends Observable {
|
|
|
199
375
|
get(name) {
|
|
200
376
|
return this._map[name];
|
|
201
377
|
}
|
|
378
|
+
/**
|
|
379
|
+
* Updates the specified property with the provided value.
|
|
380
|
+
*/
|
|
202
381
|
set(name, value) {
|
|
203
382
|
const currentValue = this._map[name];
|
|
204
383
|
if (currentValue === value) {
|
|
@@ -231,11 +410,20 @@ function addPropertiesFromObject(observable, source, recursive = false) {
|
|
|
231
410
|
observable.set(prop, value);
|
|
232
411
|
});
|
|
233
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* Creates an Observable instance and sets its properties according to the supplied JavaScript object.
|
|
415
|
+
* param obj - A JavaScript object used to initialize nativescript Observable instance.
|
|
416
|
+
*/
|
|
234
417
|
export function fromObject(source) {
|
|
235
418
|
const observable = new ObservableFromObject();
|
|
236
419
|
addPropertiesFromObject(observable, source, false);
|
|
237
420
|
return observable;
|
|
238
421
|
}
|
|
422
|
+
/**
|
|
423
|
+
* Creates an Observable instance and sets its properties according to the supplied JavaScript object.
|
|
424
|
+
* This function will create new Observable for each nested object (expect arrays and functions) from supplied JavaScript object.
|
|
425
|
+
* param obj - A JavaScript object used to initialize nativescript Observable instance.
|
|
426
|
+
*/
|
|
239
427
|
export function fromObjectRecursive(source) {
|
|
240
428
|
const observable = new ObservableFromObject();
|
|
241
429
|
addPropertiesFromObject(observable, source, true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/data/observable/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/data/observable/index.ts"],"names":[],"mappings":"AA4CA,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;GAIG;AACH,MAAM,OAAO,YAAY;IACxB;;;OAGG;IACH;IACC;;OAEG;IACI,OAAY;QAAZ,YAAO,GAAP,OAAO,CAAK;IACjB,CAAC;IAEJ;;;OAGG;IACI,MAAM,CAAC,MAAM,CAAC,KAAU;QAC9B,OAAO,KAAK,YAAY,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,IAAI,CAAC,KAAU;QAC5B,MAAM,CAAC,GAAG,cAAc,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC;QAElB,OAAO,CAAC,CAAC;IACV,CAAC;CACD;AAED,MAAM,cAAc,GAAG,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,YAAY,CAAC,IAA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;IACrC,MAAM,UAAU,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC9C,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAEnD,OAAO,UAAU,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAW;IAC9C,MAAM,UAAU,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC9C,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAElD,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -37,9 +37,16 @@ export declare class FileSystemAccess implements IFileSystemAccess {
|
|
|
37
37
|
getLogicalRootPath(): string;
|
|
38
38
|
getTempFolderPath(): string;
|
|
39
39
|
getCurrentAppPath(): string;
|
|
40
|
+
readBuffer: any;
|
|
41
|
+
readBufferAsync(path: string): Promise<ArrayBuffer>;
|
|
42
|
+
readBufferSync(path: string, onError?: (error: any) => any): ArrayBuffer;
|
|
40
43
|
read: any;
|
|
41
44
|
readAsync(path: string): Promise<number[]>;
|
|
42
45
|
readSync(path: string, onError?: (error: any) => any): any;
|
|
46
|
+
static getBuffer(buffer: ArrayBuffer | Uint8Array | Uint8ClampedArray): any;
|
|
47
|
+
writeBuffer: any;
|
|
48
|
+
writeBufferAsync(path: string, buffer: ArrayBuffer | Uint8Array | Uint8ClampedArray): Promise<void>;
|
|
49
|
+
writeBufferSync(path: string, buffer: ArrayBuffer | Uint8Array | Uint8ClampedArray, onError?: (error: any) => any): void;
|
|
43
50
|
write: any;
|
|
44
51
|
writeAsync(path: string, bytes: androidNative.Array<number>): Promise<void>;
|
|
45
52
|
writeSync(path: string, bytes: androidNative.Array<number>, onError?: (error: any) => any): void;
|
|
@@ -100,12 +107,18 @@ export declare class FileSystemAccess29 extends FileSystemAccess {
|
|
|
100
107
|
readText: any;
|
|
101
108
|
readTextAsync(path: string, encoding?: any): Promise<string>;
|
|
102
109
|
readTextSync(path: string, onError?: (error: any) => any, encoding?: any): string;
|
|
110
|
+
readBuffer: any;
|
|
111
|
+
readBufferAsync(path: string): Promise<any>;
|
|
112
|
+
readBufferSync(path: string, onError?: (error: any) => any): any;
|
|
103
113
|
read: any;
|
|
104
114
|
readAsync(path: string): Promise<any>;
|
|
105
115
|
readSync(path: string, onError?: (error: any) => any): any;
|
|
106
116
|
writeText: any;
|
|
107
117
|
writeTextAsync(path: string, content: string, encoding?: any): Promise<void>;
|
|
108
118
|
writeTextSync(path: string, content: string, onError?: (error: any) => any, encoding?: any): void;
|
|
119
|
+
writeBuffer: any;
|
|
120
|
+
writeBufferAsync(path: string, content: any): Promise<void>;
|
|
121
|
+
writeBufferSync(path: string, content: any, onError?: (error: any) => any): void;
|
|
109
122
|
write: any;
|
|
110
123
|
writeAsync(path: string, content: any): Promise<void>;
|
|
111
124
|
writeSync(path: string, content: any, onError?: (error: any) => any): void;
|