@akylas/nativescript
Advanced tools
Comparing version 8.3.0 to 8.3.1
@@ -45,3 +45,3 @@ import { Observable, EventData } from '../observable'; | ||
constructor(args?: T[] | number); | ||
[Symbol.iterator](): Generator<any, void, unknown>; | ||
[Symbol.iterator](): Generator<T, void, unknown>; | ||
/** | ||
@@ -86,3 +86,3 @@ * Returns item at specified position. | ||
*/ | ||
push(...args: any): number; | ||
push(...args: T[]): number; | ||
_notifyLengthChange(): void; | ||
@@ -117,3 +117,3 @@ /** | ||
*/ | ||
splice(start: number, deleteCount?: number, ...items: any): ObservableArray<T>; | ||
splice(start: number, deleteCount?: number, ...items: T[]): ObservableArray<T>; | ||
/** | ||
@@ -123,3 +123,3 @@ * Inserts new elements at the start of an array. | ||
*/ | ||
unshift(...args: any): number; | ||
unshift(...args: T[]): number; | ||
/** | ||
@@ -130,3 +130,3 @@ * Returns the first element in the array where predicate is true, and null otherwise. | ||
*/ | ||
find(callbackfn: (value: T, index: number, array: ObservableArray<T>) => any, thisArg?: any): number; | ||
find(callbackfn: (value: T, index: number, array: ObservableArray<T>) => any, thisArg?: any): T; | ||
/** | ||
@@ -133,0 +133,0 @@ * Returns the index of the first element in the array where predicate is true, and -1 otherwise. |
@@ -36,2 +36,3 @@ import type { IFileSystemAccess } from './file-system-access'; | ||
getDocumentsFolderPath(): string; | ||
getExternalDocumentsFolderPath(): string; | ||
getLogicalRootPath(): string; | ||
@@ -38,0 +39,0 @@ getTempFolderPath(): string; |
@@ -186,2 +186,6 @@ import * as textModule from '../text'; | ||
} | ||
getExternalDocumentsFolderPath() { | ||
const dir = getApplicationContext().getExternalFilesDir(null); | ||
return dir.getAbsolutePath(); | ||
} | ||
getLogicalRootPath() { | ||
@@ -188,0 +192,0 @@ const dir = getApplicationContext().getFilesDir(); |
@@ -104,2 +104,8 @@ /** | ||
/** | ||
* Gets the special documents folder on external storage. | ||
* As there is no external storage on iOS it is the same as getDocumentsFolderPath | ||
*/ | ||
getExternalDocumentsFolderPath(): string; | ||
/** | ||
* Gets the special temp folder. | ||
@@ -106,0 +112,0 @@ * Returns for Android: "/data/data/applicationPackageName/cache", iOS: "/var/mobile/Applications/appID/Library/Caches" |
@@ -41,2 +41,3 @@ export declare class FileSystemAccess { | ||
getDocumentsFolderPath(): string; | ||
getExternalDocumentsFolderPath(): string; | ||
getTempFolderPath(): string; | ||
@@ -43,0 +44,0 @@ getCurrentAppPath(): string; |
@@ -210,2 +210,5 @@ import { encoding as textEncoding } from '../text'; | ||
} | ||
getExternalDocumentsFolderPath() { | ||
return this.getDocumentsFolderPath(); | ||
} | ||
getTempFolderPath() { | ||
@@ -212,0 +215,0 @@ return this.getKnownPath(13 /* NSSearchPathDirectory.CachesDirectory */); |
@@ -54,2 +54,3 @@ import { IFileSystemAccess } from './file-system-access'; | ||
function documents(): Folder; | ||
function externalDocuments(): Folder; | ||
function temp(): Folder; | ||
@@ -56,0 +57,0 @@ function currentApp(): Folder; |
@@ -448,2 +448,12 @@ import { FileSystemAccess, FileSystemAccess29 } from './file-system-access'; | ||
knownFolders.documents = documents; | ||
function externalDocuments() { | ||
if (!_documents) { | ||
const path = getFileAccess().getExternalDocumentsFolderPath(); | ||
_documents = new Folder(); | ||
_documents._path = path; | ||
_documents._isKnown = true; | ||
} | ||
return _documents; | ||
} | ||
knownFolders.externalDocuments = externalDocuments; | ||
function temp() { | ||
@@ -450,0 +460,0 @@ if (!_temp) { |
@@ -6,3 +6,5 @@ import * as definition from './fps-native'; | ||
running: boolean; | ||
sdkVersion: number; | ||
constructor(onFrame: (currentTimeMillis: number) => void); | ||
private _isNativeFramesSupported; | ||
start(): void; | ||
@@ -9,0 +11,0 @@ stop(): void; |
@@ -0,1 +1,2 @@ | ||
import { Device } from '../platform'; | ||
export class FPSCallback { | ||
@@ -5,8 +6,19 @@ constructor(onFrame) { | ||
this.onFrame = onFrame; | ||
this.impl = new android.view.Choreographer.FrameCallback({ | ||
doFrame: (nanos) => { | ||
this.sdkVersion = parseInt(Device.sdkVersion); | ||
if (this.sdkVersion >= 24 && this._isNativeFramesSupported()) { | ||
this.impl = (nanos) => { | ||
this.handleFrame(nanos); | ||
}, | ||
}); | ||
}; | ||
} | ||
else { | ||
this.impl = new android.view.Choreographer.FrameCallback({ | ||
doFrame: (nanos) => { | ||
this.handleFrame(nanos); | ||
}, | ||
}); | ||
} | ||
} | ||
_isNativeFramesSupported() { | ||
return typeof global.__postFrameCallback === 'function' && typeof global.__removeFrameCallback === 'function'; | ||
} | ||
start() { | ||
@@ -16,3 +28,8 @@ if (this.running) { | ||
} | ||
android.view.Choreographer.getInstance().postFrameCallback(this.impl); | ||
if (this.sdkVersion >= 24 && this._isNativeFramesSupported()) { | ||
global.__postFrameCallback(this.impl); | ||
} | ||
else { | ||
android.view.Choreographer.getInstance().postFrameCallback(this.impl); | ||
} | ||
this.running = true; | ||
@@ -24,3 +41,8 @@ } | ||
} | ||
android.view.Choreographer.getInstance().removeFrameCallback(this.impl); | ||
if (this.sdkVersion >= 24 && this._isNativeFramesSupported()) { | ||
global.__removeFrameCallback(this.impl); | ||
} | ||
else { | ||
android.view.Choreographer.getInstance().removeFrameCallback(this.impl); | ||
} | ||
this.running = false; | ||
@@ -35,5 +57,10 @@ } | ||
// add the FrameCallback instance again since it is automatically removed from the Choreographer | ||
android.view.Choreographer.getInstance().postFrameCallback(this.impl); | ||
if (this.sdkVersion >= 24 && this._isNativeFramesSupported()) { | ||
global.__postFrameCallback(this.impl); | ||
} | ||
else { | ||
android.view.Choreographer.getInstance().postFrameCallback(this.impl); | ||
} | ||
} | ||
} | ||
//# sourceMappingURL=fps-native.android.js.map |
@@ -109,3 +109,3 @@ const tslib = require('tslib'); | ||
// breaks extending native-classes | ||
for (const fnName of Object.keys(tslib)) { | ||
for (const fnName of Object.getOwnPropertyNames(tslib)) { | ||
if (typeof tslib[fnName] !== 'function') { | ||
@@ -112,0 +112,0 @@ continue; |
{ | ||
"name": "@akylas/nativescript", | ||
"version": "8.3.0", | ||
"version": "8.3.1", | ||
"description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.", | ||
@@ -41,3 +41,3 @@ "main": "index", | ||
"reduce-css-calc": "^2.1.7", | ||
"tslib": "2.1.0" | ||
"tslib": "^2.0.0" | ||
}, | ||
@@ -44,0 +44,0 @@ "nativescript": { |
@@ -74,2 +74,3 @@ { | ||
"android.os:IBinder*", | ||
"android.os:LocaleList*", | ||
"android.view:Window*", | ||
@@ -76,0 +77,0 @@ "android.view:View*", |
@@ -242,2 +242,6 @@ import { AlignSelf, FlexGrow, FlexShrink, FlexWrapBefore, Order } from '../../layouts/flexbox-layout'; | ||
*/ | ||
_removeFromNativeVisualTree(): void; | ||
/** | ||
* Method is intended to be overridden by inheritors and used as "protected" | ||
*/ | ||
_removeViewFromNativeVisualTree(view: ViewBase): void; | ||
@@ -244,0 +248,0 @@ _goToVisualState(state: string): void; |
@@ -663,2 +663,6 @@ import { Property, InheritedProperty, clearInheritedProperties, propagateInheritableProperties, propagateInheritableCssProperties, initNativeView } from '../properties'; | ||
} | ||
else { | ||
//ensure we still remove the view or we could create memory leaks | ||
this._removeFromNativeVisualTree(); | ||
} | ||
// const nativeView = this.nativeViewProtected; | ||
@@ -709,2 +713,8 @@ // if (nativeView && global.isAndroid) { | ||
*/ | ||
_removeFromNativeVisualTree() { | ||
this._isAddedToNativeVisualTree = false; | ||
} | ||
/** | ||
* Method is intended to be overridden by inheritors and used as "protected" | ||
*/ | ||
_removeViewFromNativeVisualTree(view) { | ||
@@ -711,0 +721,0 @@ view._isAddedToNativeVisualTree = false; |
@@ -84,3 +84,4 @@ import type { Point, CustomLayoutView as CustomLayoutViewDefinition } from '.'; | ||
_setChildMinHeightNative(child: View, value: CoreTypes.LengthType): void; | ||
_removeFromNativeVisualTree(): void; | ||
_removeViewFromNativeVisualTree(child: ViewCommon): void; | ||
} |
@@ -1068,2 +1068,10 @@ // Types. | ||
} | ||
_removeFromNativeVisualTree() { | ||
var _a; | ||
super._removeFromNativeVisualTree(); | ||
const parent = (_a = this.nativeViewProtected) === null || _a === void 0 ? void 0 : _a.getParent(); | ||
if (parent && parent['removeView']) { | ||
parent['removeView'](this.nativeViewProtected); | ||
} | ||
} | ||
_removeViewFromNativeVisualTree(child) { | ||
@@ -1070,0 +1078,0 @@ super._removeViewFromNativeVisualTree(child); |
@@ -92,3 +92,4 @@ import { Point, View as ViewDefinition } from '.'; | ||
_addViewToNativeVisualTree(child: View, atIndex: number): boolean; | ||
_removeFromNativeVisualTree(): void; | ||
_removeViewFromNativeVisualTree(child: View): void; | ||
} |
@@ -811,2 +811,8 @@ // Requires | ||
} | ||
_removeFromNativeVisualTree() { | ||
super._removeFromNativeVisualTree(); | ||
if (this.nativeViewProtected) { | ||
this.nativeViewProtected.removeFromSuperview(); | ||
} | ||
} | ||
_removeViewFromNativeVisualTree(child) { | ||
@@ -813,0 +819,0 @@ super._removeViewFromNativeVisualTree(child); |
@@ -61,4 +61,4 @@ import { Span } from './span'; | ||
let result = ''; | ||
for (let i = 0, length = this._spans.length; i < length; i++) { | ||
result += this._spans.getItem(i).text; | ||
for (let i = 0, length = this.spans.length; i < length; i++) { | ||
result += this.spans.getItem(i).text; | ||
} | ||
@@ -69,3 +69,3 @@ return result; | ||
if (name === 'spans') { | ||
this.spans.push(value); | ||
this.spans.push(...value); | ||
} | ||
@@ -72,0 +72,0 @@ } |
export declare function dispatchToMainThread(func: () => void): void; | ||
export declare function isMainThread(): boolean; | ||
export declare function dispatchToUIThread(func: () => void): (func: any) => void; | ||
export declare function dispatchToUIThread(func: () => void): void; |
@@ -0,5 +1,14 @@ | ||
import { android as ad } from '../application'; | ||
export function dispatchToMainThread(func) { | ||
new android.os.Handler(android.os.Looper.getMainLooper()).post(new java.lang.Runnable({ | ||
run: func, | ||
})); | ||
const runOnMainThread = global.__runOnMainThread; | ||
if (runOnMainThread) { | ||
runOnMainThread(() => { | ||
func(); | ||
}); | ||
} | ||
else { | ||
new android.os.Handler(android.os.Looper.getMainLooper()).post(new java.lang.Runnable({ | ||
run: func, | ||
})); | ||
} | ||
} | ||
@@ -10,8 +19,11 @@ export function isMainThread() { | ||
export function dispatchToUIThread(func) { | ||
return function (func) { | ||
if (func) { | ||
func(); | ||
} | ||
}; | ||
const activity = ad.foregroundActivity || ad.startActivity; | ||
if (activity && func) { | ||
activity.runOnUiThread(new java.lang.Runnable({ | ||
run() { | ||
func(); | ||
}, | ||
})); | ||
} | ||
} | ||
//# sourceMappingURL=mainthread-helper.android.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13127656
73898
+ Addedtslib@2.8.1(transitive)
- Removedtslib@2.1.0(transitive)
Updatedtslib@^2.0.0