Platform-specific TypeScript declarations for NativeScript for accessing native objects
84
A utility module for managing memory when working with native platform objects in NativeScript applications. This module helps prevent memory leaks by properly releasing native object references and triggering garbage collection when needed.
Implement a function that explicitly releases native object references to free up memory. The function should handle both Android and iOS native objects.
Implement a function that triggers garbage collection on the appropriate platform to reclaim memory from released native objects.
Implement a function that processes an array of native objects, releasing each one and then triggering garbage collection. The function should return statistics about the cleanup operation.
@generates
/**
* Releases the native counterpart of a native object.
*
* @param obj - The native object to release
* @returns true if the object was released successfully, false otherwise
*/
export function releaseNativeObject(obj: any): boolean;
/**
* Triggers garbage collection on the current platform.
*
* @returns The platform name ("android" or "ios")
*/
export function triggerGarbageCollection(): string;
/**
* Performs batch cleanup of native objects by releasing each one
* and triggering garbage collection.
*
* @param objects - Array of native objects to release
* @returns Statistics object with successfulReleases count
*/
export function batchCleanup(objects: any[]): { successfulReleases: number };Provides TypeScript declarations for NativeScript platform APIs including memory management functions.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-tns-platform-declarationsevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10