mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
No more ambient modules for tns-core-modules/* subpackages.
- Use path mappings in tsconfig.json to resolve module typings - Only use ambient mobules for global API's - Move single-file modules to a subdir with the same name so that we can provide a hand-written typing next to it (via package.json) - Delete all mentions of tns-core-modules.d.ts - Delete reference d.ts assembly build steps. Not needed anymore. - HACK! Use a <reference> for global typings in application.d.ts to avoid publishing a separate @types/tns-core-modules package. - Rename declarations.d.ts to tns-core-modules.d.ts to preserve JS project mappings in references.d.ts (the only place we use those)
This commit is contained in:
committed by
Hristo Deshev
parent
1af8c6ca8e
commit
b45cbe929b
128
tns-core-modules/utils/debug.d.ts
vendored
128
tns-core-modules/utils/debug.d.ts
vendored
@@ -1,67 +1,65 @@
|
||||
declare module "utils/debug" {
|
||||
/**
|
||||
* A runtime option indicating whether the build has debugging enabled.
|
||||
*/
|
||||
export var debug: boolean;
|
||||
|
||||
/**
|
||||
* A class encapsulating information for source code origin.
|
||||
*/
|
||||
export class Source {
|
||||
|
||||
/**
|
||||
* Creates a new Source instance by given uri, line and column.
|
||||
*/
|
||||
constructor(uri: string, line: number, column: number);
|
||||
|
||||
/**
|
||||
* Gets the URI of the source document;
|
||||
*/
|
||||
uri: string;
|
||||
|
||||
/**
|
||||
* Gets the line in the source document.
|
||||
*/
|
||||
line: number;
|
||||
|
||||
/**
|
||||
* Gets the position in the source document.
|
||||
*/
|
||||
column: number;
|
||||
|
||||
/**
|
||||
* Get the source of an object.
|
||||
*/
|
||||
public static get(object: any): Source;
|
||||
|
||||
/**
|
||||
* Set the source of an object.
|
||||
*/
|
||||
public static set(object: any, src: Source);
|
||||
}
|
||||
|
||||
/**
|
||||
* An Error class that provides additional context to an error.
|
||||
*/
|
||||
export class ScopeError extends Error {
|
||||
/**
|
||||
* Creates a new ScopeError providing addtional context to the child error.
|
||||
* @param child The child error to extend.
|
||||
* @param message Additional message to prepend to the child error.
|
||||
*/
|
||||
constructor(child: Error, message?: string);
|
||||
}
|
||||
/**
|
||||
* A runtime option indicating whether the build has debugging enabled.
|
||||
*/
|
||||
export var debug: boolean;
|
||||
|
||||
/**
|
||||
* Represents a scope error providing addiot
|
||||
*/
|
||||
export class SourceError extends ScopeError {
|
||||
/**
|
||||
* Creates a new SourceError by child error, source and optional message.
|
||||
* @param child The child error to extend.
|
||||
* @param source The source where the error occured.
|
||||
* @param message Additonal message to prepend along the source location and the child error's message.
|
||||
*/
|
||||
constructor(child: Error, source: Source, message?: string);
|
||||
}
|
||||
/**
|
||||
* A class encapsulating information for source code origin.
|
||||
*/
|
||||
export class Source {
|
||||
|
||||
/**
|
||||
* Creates a new Source instance by given uri, line and column.
|
||||
*/
|
||||
constructor(uri: string, line: number, column: number);
|
||||
|
||||
/**
|
||||
* Gets the URI of the source document;
|
||||
*/
|
||||
uri: string;
|
||||
|
||||
/**
|
||||
* Gets the line in the source document.
|
||||
*/
|
||||
line: number;
|
||||
|
||||
/**
|
||||
* Gets the position in the source document.
|
||||
*/
|
||||
column: number;
|
||||
|
||||
/**
|
||||
* Get the source of an object.
|
||||
*/
|
||||
public static get(object: any): Source;
|
||||
|
||||
/**
|
||||
* Set the source of an object.
|
||||
*/
|
||||
public static set(object: any, src: Source);
|
||||
}
|
||||
|
||||
/**
|
||||
* An Error class that provides additional context to an error.
|
||||
*/
|
||||
export class ScopeError extends Error {
|
||||
/**
|
||||
* Creates a new ScopeError providing addtional context to the child error.
|
||||
* @param child The child error to extend.
|
||||
* @param message Additional message to prepend to the child error.
|
||||
*/
|
||||
constructor(child: Error, message?: string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a scope error providing addiot
|
||||
*/
|
||||
export class SourceError extends ScopeError {
|
||||
/**
|
||||
* Creates a new SourceError by child error, source and optional message.
|
||||
* @param child The child error to extend.
|
||||
* @param source The source where the error occured.
|
||||
* @param message Additonal message to prepend along the source location and the child error's message.
|
||||
*/
|
||||
constructor(child: Error, source: Source, message?: string);
|
||||
}
|
||||
|
||||
14
tns-core-modules/utils/lazy.d.ts
vendored
14
tns-core-modules/utils/lazy.d.ts
vendored
@@ -1,8 +1,6 @@
|
||||
declare module "utils/lazy" {
|
||||
/**
|
||||
* A function that evaluates the action only once.
|
||||
* @param action The action to be evaluated to get the result.
|
||||
* Returns the evaluated result.
|
||||
*/
|
||||
export default function lazy<T>(action: () => T): () => T;
|
||||
}
|
||||
/**
|
||||
* A function that evaluates the action only once.
|
||||
* @param action The action to be evaluated to get the result.
|
||||
* Returns the evaluated result.
|
||||
*/
|
||||
export default function lazy<T>(action: () => T): () => T;
|
||||
|
||||
198
tns-core-modules/utils/types.d.ts
vendored
198
tns-core-modules/utils/types.d.ts
vendored
@@ -1,106 +1,104 @@
|
||||
declare module "utils/types" {
|
||||
/**
|
||||
* A function that checks if something is a valid string.
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is a string.
|
||||
*/
|
||||
export function isString(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is a valid number.
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is a number.
|
||||
*/
|
||||
export function isNumber(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is a valid boolean.
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is a boolean.
|
||||
*/
|
||||
export function isBoolean(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is a function.
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is a function.
|
||||
*/
|
||||
export function isFunction(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is an object.
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is an object.
|
||||
*/
|
||||
export function isObject(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is "undefined".
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is "undefined".
|
||||
*/
|
||||
export function isUndefined(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is defined (not undefined).
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is defined.
|
||||
*/
|
||||
export function isDefined(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is not defined (null or undefined).
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is null or undefined.
|
||||
*/
|
||||
export function isNullOrUndefined(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is a valid function.
|
||||
* @param value The value which will be checked.
|
||||
* Throws exception if passed value is not a valid function.
|
||||
*/
|
||||
export function verifyCallback(value: any): void;
|
||||
|
||||
/**
|
||||
* A function that gets the class name of an object.
|
||||
* @param object The object which class will be get.
|
||||
* Returns a string with the name of the class.
|
||||
*/
|
||||
export function getClass(object): string;
|
||||
|
||||
/**
|
||||
* A function that gets the entire class hierarchy of an object.
|
||||
* @param object The object which class hierarchy will be get.
|
||||
* Return an array of strings with the name of all classes.
|
||||
*/
|
||||
export function getBaseClasses(object): Array<string>;
|
||||
|
||||
/**
|
||||
* A function that gets the ClassInfo for an object.
|
||||
* @param object The object for which the ClassInfo will be get.
|
||||
* Returns a ClassInfo for the object.
|
||||
*/
|
||||
export function getClassInfo(object: Object): ClassInfo;
|
||||
|
||||
/**
|
||||
* A Class holding information about a class
|
||||
*/
|
||||
export class ClassInfo {
|
||||
/**
|
||||
* A function that checks if something is a valid string.
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is a string.
|
||||
* Gets the name of the class.
|
||||
*/
|
||||
export function isString(value: any): boolean;
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* A function that checks if something is a valid number.
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is a number.
|
||||
* Gets the ClassInfo for the base class of the current info.
|
||||
*/
|
||||
export function isNumber(value: any): boolean;
|
||||
baseClassInfo: ClassInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that checks if something is a valid boolean.
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is a boolean.
|
||||
*/
|
||||
export function isBoolean(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is a function.
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is a function.
|
||||
*/
|
||||
export function isFunction(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is an object.
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is an object.
|
||||
*/
|
||||
export function isObject(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is "undefined".
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is "undefined".
|
||||
*/
|
||||
export function isUndefined(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is defined (not undefined).
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is defined.
|
||||
*/
|
||||
export function isDefined(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is not defined (null or undefined).
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is null or undefined.
|
||||
*/
|
||||
export function isNullOrUndefined(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is a valid function.
|
||||
* @param value The value which will be checked.
|
||||
* Throws exception if passed value is not a valid function.
|
||||
*/
|
||||
export function verifyCallback(value: any): void;
|
||||
|
||||
/**
|
||||
* A function that gets the class name of an object.
|
||||
* @param object The object which class will be get.
|
||||
* Returns a string with the name of the class.
|
||||
*/
|
||||
export function getClass(object): string;
|
||||
|
||||
/**
|
||||
* A function that gets the entire class hierarchy of an object.
|
||||
* @param object The object which class hierarchy will be get.
|
||||
* Return an array of strings with the name of all classes.
|
||||
*/
|
||||
export function getBaseClasses(object): Array<string>;
|
||||
|
||||
/**
|
||||
* A function that gets the ClassInfo for an object.
|
||||
* @param object The object for which the ClassInfo will be get.
|
||||
* Returns a ClassInfo for the object.
|
||||
*/
|
||||
export function getClassInfo(object: Object): ClassInfo;
|
||||
|
||||
/**
|
||||
* A Class holding information about a class
|
||||
*/
|
||||
export class ClassInfo {
|
||||
/**
|
||||
* Gets the name of the class.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Gets the ClassInfo for the base class of the current info.
|
||||
*/
|
||||
baseClassInfo: ClassInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of a string to be shown in UI.
|
||||
* @param object The object which class hierarchy will be get.
|
||||
*/
|
||||
export function toUIString(object): string;
|
||||
}
|
||||
/**
|
||||
* Returns a string representation of a string to be shown in UI.
|
||||
* @param object The object which class hierarchy will be get.
|
||||
*/
|
||||
export function toUIString(object): string;
|
||||
|
||||
471
tns-core-modules/utils/utils.d.ts
vendored
471
tns-core-modules/utils/utils.d.ts
vendored
@@ -1,227 +1,248 @@
|
||||
declare module "utils/utils" {
|
||||
export var RESOURCE_PREFIX: string;
|
||||
import * as colorModule from "color";
|
||||
export var RESOURCE_PREFIX: string;
|
||||
|
||||
//@private
|
||||
/**
|
||||
* Used to cache and restore Android views' layer type, i.e. android.view.View.getLayerType and android.view.View.setLayerType.
|
||||
*/
|
||||
interface CacheLayerType {
|
||||
layerType: number;
|
||||
setLayerType(layerType: number, paint: any): void;
|
||||
getLayerType(): number;
|
||||
}
|
||||
//@endprivate
|
||||
|
||||
/**
|
||||
* Utility module related to layout.
|
||||
*/
|
||||
module layout {
|
||||
/**
|
||||
* Bits that provide the actual measured size.
|
||||
*/
|
||||
export var MEASURED_HEIGHT_STATE_SHIFT: number;
|
||||
export var MEASURED_SIZE_MASK: number;
|
||||
export var MEASURED_STATE_MASK: number;
|
||||
export var MEASURED_STATE_TOO_SMALL: number;
|
||||
export var UNSPECIFIED: number;
|
||||
export var EXACTLY: number;
|
||||
export var AT_MOST: number;
|
||||
/**
|
||||
* Gets measure specification mode from a given specification as string.
|
||||
* @param mode - The measure specification mode.
|
||||
*/
|
||||
export function getMode(mode: number): string;
|
||||
/**
|
||||
* Gets measure specification mode from a given specification.
|
||||
* @param spec - The measure specification.
|
||||
*/
|
||||
export function getMeasureSpecMode(spec: number): number;
|
||||
/**
|
||||
* Gets measure specification size from a given specification.
|
||||
* @param spec - The measure specification.
|
||||
*/
|
||||
export function getMeasureSpecSize(spec: number): number;
|
||||
/**
|
||||
* Creates measure specification size from size and mode.
|
||||
* @param size - The size component of measure specification.
|
||||
* @param mode - The mode component of measure specification.
|
||||
*/
|
||||
export function makeMeasureSpec(size: number, mode: number): number;
|
||||
/**
|
||||
* Gets display density for the current device.
|
||||
*/
|
||||
export function getDisplayDensity(): number;
|
||||
/**
|
||||
* Convert value to device pixels.
|
||||
* @param value - The pixel to convert.
|
||||
*/
|
||||
export function toDevicePixels(value: number): number;
|
||||
/**
|
||||
* Convert value to device independent pixels.
|
||||
* @param value - The pixel to convert.
|
||||
*/
|
||||
export function toDeviceIndependentPixels(value: number): number;
|
||||
|
||||
export function measureSpecToString(measureSpec: number): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module with android specific utilities.
|
||||
*/
|
||||
module ad {
|
||||
/**
|
||||
* Gets the native Android application instance.
|
||||
*/
|
||||
export function getApplication(): any /* android.app.Application */;
|
||||
|
||||
/**
|
||||
* Gets the Android application context.
|
||||
*/
|
||||
export function getApplicationContext(): any /* android.content.Context */;
|
||||
|
||||
/**
|
||||
* Gets the native Android input method manager.
|
||||
*/
|
||||
export function getInputMethodManager(): any /* android.view.inputmethod.InputMethodManager */;
|
||||
|
||||
/**
|
||||
* Hides the soft input method, ususally a soft keyboard.
|
||||
*/
|
||||
export function dismissSoftInput(nativeView: any /* android.view.View */): void;
|
||||
|
||||
/**
|
||||
* Shows the soft input method, ususally a soft keyboard.
|
||||
*/
|
||||
export function showSoftInput(nativeView: any /* android.view.View */): void;
|
||||
|
||||
/**
|
||||
* Utility module dealing with some android collections.
|
||||
*/
|
||||
module collections {
|
||||
/**
|
||||
* Converts string array into a String [hash set](http://developer.android.com/reference/java/util/HashSet.html).
|
||||
* @param str - An array of strings to convert.
|
||||
*/
|
||||
export function stringArrayToStringSet(str: string[]): any;
|
||||
/**
|
||||
* Converts string hash set into array of strings.
|
||||
* @param stringSet - A string hash set to convert.
|
||||
*/
|
||||
export function stringSetToStringArray(stringSet: any): string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility module related to android resources.
|
||||
*/
|
||||
module resources {
|
||||
/**
|
||||
* Gets the drawable id from a given name.
|
||||
* @param name - Name of the resource.
|
||||
*/
|
||||
export function getDrawableId(name);
|
||||
/**
|
||||
* Gets the string id from a given name.
|
||||
* @param name - Name of the resource.
|
||||
*/
|
||||
export function getStringId(name)
|
||||
|
||||
/**
|
||||
* Gets the id from a given name.
|
||||
* @param name - Name of the resource.
|
||||
*/
|
||||
export function getId(name: string): number;
|
||||
|
||||
/**
|
||||
* Gets a color from the current theme.
|
||||
* @param name - Name of the color resource.
|
||||
*/
|
||||
export function getPalleteColor(name: string, context: any /* android.content.Context */): number;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Module with ios specific utilities.
|
||||
*/
|
||||
module ios {
|
||||
/**
|
||||
* Checks if the property is a function and if it is, calls it on this.
|
||||
* Designed to support backward compatibility for methods that became properties.
|
||||
* Will not work on delegates since it checks if the propertyValue is a function, and delegates are marshalled as functions.
|
||||
* Example: getter(NSRunLoop, NSRunLoop.currentRunLoop).runUntilDate(NSDate.dateWithTimeIntervalSinceNow(waitTime));
|
||||
*/
|
||||
export function getter<T>(_this: any, propertyValue: T | {(): T}): T;
|
||||
|
||||
/**
|
||||
* Utility module dealing with some iOS collections.
|
||||
*/
|
||||
module collections {
|
||||
/**
|
||||
* Converts JavaScript array to [NSArray](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/).
|
||||
* @param str - JavaScript string array to convert.
|
||||
*/
|
||||
export function jsArrayToNSArray(str: string[]): any;
|
||||
/**
|
||||
* Converts NSArray to JavaScript array.
|
||||
* @param str - NSArray to convert.
|
||||
*/
|
||||
export function nsArrayToJSArray(a: any): string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an information about if current mode is Landscape.
|
||||
*/
|
||||
export function isLandscape(): boolean;
|
||||
|
||||
/**
|
||||
* Gets the iOS device major version (for 8.1 will return 8).
|
||||
*/
|
||||
export var MajorVersion: number;
|
||||
|
||||
/**
|
||||
* Opens file with associated application.
|
||||
* @param filePath The file path.
|
||||
*/
|
||||
export function openFile(filePath: string): boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* An utility function that invokes garbage collection on the JavaScript side.
|
||||
*/
|
||||
export function GC();
|
||||
|
||||
/**
|
||||
* Returns true if the specified path points to a resource or local file.
|
||||
* @param path The path.
|
||||
*/
|
||||
export function isFileOrResourcePath(path: string): boolean
|
||||
|
||||
/**
|
||||
* Returns true if the specified URI is data URI (http://en.wikipedia.org/wiki/Data_URI_scheme).
|
||||
* @param uri The URI.
|
||||
*/
|
||||
export function isDataURI(uri: string): boolean
|
||||
|
||||
/**
|
||||
* Opens url.
|
||||
* @param url The url.
|
||||
*/
|
||||
export function openUrl(url: string): boolean
|
||||
|
||||
/**
|
||||
* Escapes special regex symbols (., *, ^, $ and so on) in string in order to create a valid regex from it.
|
||||
* @param source The original value.
|
||||
*/
|
||||
export function escapeRegexSymbols(source: string): string
|
||||
|
||||
/**
|
||||
* Converts string value to number or boolean.
|
||||
* @param value The original value.
|
||||
*/
|
||||
export function convertString(value: string): boolean | number;
|
||||
|
||||
/**
|
||||
* Sorts an array by using merge sort algoritm (which ensures stable sort since the built-in Array.sort() does not promise a stable sort).
|
||||
* @param arr - array to be sorted
|
||||
* @param compareFunc - function that will be used to compare two elements of the array
|
||||
*/
|
||||
export function mergeSort(arr: Array<any>, compareFunc: (a: any, b: any) => number): Array<any>
|
||||
//@private
|
||||
/**
|
||||
* Used by various android event listener implementations
|
||||
*/
|
||||
interface Owned {
|
||||
owner: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to cache and restore Android views' layer type, i.e. android.view.View.getLayerType and android.view.View.setLayerType.
|
||||
*/
|
||||
interface CacheLayerType {
|
||||
layerType: number;
|
||||
setLayerType(layerType: number, paint: any): void;
|
||||
getLayerType(): number;
|
||||
}
|
||||
//@endprivate
|
||||
|
||||
/**
|
||||
* Utility module related to layout.
|
||||
*/
|
||||
export module layout {
|
||||
/**
|
||||
* Bits that provide the actual measured size.
|
||||
*/
|
||||
export var MEASURED_HEIGHT_STATE_SHIFT: number;
|
||||
export var MEASURED_SIZE_MASK: number;
|
||||
export var MEASURED_STATE_MASK: number;
|
||||
export var MEASURED_STATE_TOO_SMALL: number;
|
||||
export var UNSPECIFIED: number;
|
||||
export var EXACTLY: number;
|
||||
export var AT_MOST: number;
|
||||
/**
|
||||
* Gets measure specification mode from a given specification as string.
|
||||
* @param mode - The measure specification mode.
|
||||
*/
|
||||
export function getMode(mode: number): string;
|
||||
/**
|
||||
* Gets measure specification mode from a given specification.
|
||||
* @param spec - The measure specification.
|
||||
*/
|
||||
export function getMeasureSpecMode(spec: number): number;
|
||||
/**
|
||||
* Gets measure specification size from a given specification.
|
||||
* @param spec - The measure specification.
|
||||
*/
|
||||
export function getMeasureSpecSize(spec: number): number;
|
||||
/**
|
||||
* Creates measure specification size from size and mode.
|
||||
* @param size - The size component of measure specification.
|
||||
* @param mode - The mode component of measure specification.
|
||||
*/
|
||||
export function makeMeasureSpec(size: number, mode: number): number;
|
||||
/**
|
||||
* Gets display density for the current device.
|
||||
*/
|
||||
export function getDisplayDensity(): number;
|
||||
/**
|
||||
* Convert value to device pixels.
|
||||
* @param value - The pixel to convert.
|
||||
*/
|
||||
export function toDevicePixels(value: number): number;
|
||||
/**
|
||||
* Convert value to device independent pixels.
|
||||
* @param value - The pixel to convert.
|
||||
*/
|
||||
export function toDeviceIndependentPixels(value: number): number;
|
||||
|
||||
export function measureSpecToString(measureSpec: number): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module with android specific utilities.
|
||||
*/
|
||||
export module ad {
|
||||
/**
|
||||
* Gets the native Android application instance.
|
||||
*/
|
||||
export function getApplication(): any /* android.app.Application */;
|
||||
|
||||
/**
|
||||
* Gets the Android application context.
|
||||
*/
|
||||
export function getApplicationContext(): any /* android.content.Context */;
|
||||
|
||||
/**
|
||||
* Gets the native Android input method manager.
|
||||
*/
|
||||
export function getInputMethodManager(): any /* android.view.inputmethod.InputMethodManager */;
|
||||
|
||||
/**
|
||||
* Hides the soft input method, ususally a soft keyboard.
|
||||
*/
|
||||
export function dismissSoftInput(nativeView: any /* android.view.View */): void;
|
||||
|
||||
/**
|
||||
* Shows the soft input method, ususally a soft keyboard.
|
||||
*/
|
||||
export function showSoftInput(nativeView: any /* android.view.View */): void;
|
||||
|
||||
/**
|
||||
* Utility module dealing with some android collections.
|
||||
*/
|
||||
module collections {
|
||||
/**
|
||||
* Converts string array into a String [hash set](http://developer.android.com/reference/java/util/HashSet.html).
|
||||
* @param str - An array of strings to convert.
|
||||
*/
|
||||
export function stringArrayToStringSet(str: string[]): any;
|
||||
/**
|
||||
* Converts string hash set into array of strings.
|
||||
* @param stringSet - A string hash set to convert.
|
||||
*/
|
||||
export function stringSetToStringArray(stringSet: any): string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility module related to android resources.
|
||||
*/
|
||||
export module resources {
|
||||
/**
|
||||
* Gets the drawable id from a given name.
|
||||
* @param name - Name of the resource.
|
||||
*/
|
||||
export function getDrawableId(name);
|
||||
/**
|
||||
* Gets the string id from a given name.
|
||||
* @param name - Name of the resource.
|
||||
*/
|
||||
export function getStringId(name)
|
||||
|
||||
/**
|
||||
* Gets the id from a given name.
|
||||
* @param name - Name of the resource.
|
||||
*/
|
||||
export function getId(name: string): number;
|
||||
|
||||
/**
|
||||
* Gets a color from the current theme.
|
||||
* @param name - Name of the color resource.
|
||||
*/
|
||||
export function getPalleteColor(name: string, context: any /* android.content.Context */): number;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Module with ios specific utilities.
|
||||
*/
|
||||
export module ios {
|
||||
/**
|
||||
* Checks if the property is a function and if it is, calls it on this.
|
||||
* Designed to support backward compatibility for methods that became properties.
|
||||
* Will not work on delegates since it checks if the propertyValue is a function, and delegates are marshalled as functions.
|
||||
* Example: getter(NSRunLoop, NSRunLoop.currentRunLoop).runUntilDate(NSDate.dateWithTimeIntervalSinceNow(waitTime));
|
||||
*/
|
||||
export function getter<T>(_this: any, propertyValue: T | {(): T}): T;
|
||||
|
||||
// Common properties between UILabel, UITextView and UITextField
|
||||
export interface TextUIView {
|
||||
font: any;
|
||||
textAlignment: number;
|
||||
textColor: any;
|
||||
text: string;
|
||||
attributedText: any;
|
||||
lineBreakMode: number;
|
||||
numberOfLines: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility module dealing with some iOS collections.
|
||||
*/
|
||||
module collections {
|
||||
/**
|
||||
* Converts JavaScript array to [NSArray](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/).
|
||||
* @param str - JavaScript string array to convert.
|
||||
*/
|
||||
export function jsArrayToNSArray(str: string[]): any;
|
||||
/**
|
||||
* Converts NSArray to JavaScript array.
|
||||
* @param str - NSArray to convert.
|
||||
*/
|
||||
export function nsArrayToJSArray(a: any): string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets NativeScript color from [UIColor](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIColor_Class/).
|
||||
* @param uiColor - UIColor instance used to create a NativeScript color.
|
||||
*/
|
||||
export function getColor(uiColor: any /* UIColor */): colorModule.Color;
|
||||
/**
|
||||
* Gets an information about if current mode is Landscape.
|
||||
*/
|
||||
export function isLandscape(): boolean;
|
||||
/**
|
||||
* Gets the iOS device major version (for 8.1 will return 8).
|
||||
*/
|
||||
export var MajorVersion: number;
|
||||
|
||||
/**
|
||||
* Opens file with associated application.
|
||||
* @param filePath The file path.
|
||||
*/
|
||||
export function openFile(filePath: string): boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* An utility function that invokes garbage collection on the JavaScript side.
|
||||
*/
|
||||
export function GC();
|
||||
|
||||
/**
|
||||
* Returns true if the specified path points to a resource or local file.
|
||||
* @param path The path.
|
||||
*/
|
||||
export function isFileOrResourcePath(path: string): boolean
|
||||
|
||||
/**
|
||||
* Returns true if the specified URI is data URI (http://en.wikipedia.org/wiki/Data_URI_scheme).
|
||||
* @param uri The URI.
|
||||
*/
|
||||
export function isDataURI(uri: string): boolean
|
||||
|
||||
/**
|
||||
* Opens url.
|
||||
* @param url The url.
|
||||
*/
|
||||
export function openUrl(url: string): boolean
|
||||
|
||||
/**
|
||||
* Escapes special regex symbols (., *, ^, $ and so on) in string in order to create a valid regex from it.
|
||||
* @param source The original value.
|
||||
*/
|
||||
export function escapeRegexSymbols(source: string): string
|
||||
|
||||
/**
|
||||
* Converts string value to number or boolean.
|
||||
* @param value The original value.
|
||||
*/
|
||||
export function convertString(value: any): any
|
||||
|
||||
/**
|
||||
* Sorts an array by using merge sort algoritm (which ensures stable sort since the built-in Array.sort() does not promise a stable sort).
|
||||
* @param arr - array to be sorted
|
||||
* @param compareFunc - function that will be used to compare two elements of the array
|
||||
*/
|
||||
export function mergeSort(arr: Array<any>, compareFunc: (a: any, b: any) => number): Array<any>
|
||||
|
||||
Reference in New Issue
Block a user