Fixed a bunch of typo's and minor errors in TypeScript definition files. (#4707)

* Fix a bunch of typo's and minor errors in TypeScript definition files.

* Implemented the requested change by @hshristov
This commit is contained in:
Eddy Verbruggen
2017-08-21 10:22:04 +02:00
committed by Hristo Hristov
parent 121ad5de01
commit 6e06eba218
17 changed files with 71 additions and 52 deletions

View File

@ -32,7 +32,7 @@ export var suspendEvent: string;
export var resumeEvent: string;
/**
* String value used when hooking to exitevent.
* String value used when hooking to exit event.
*/
export var exitEvent: string;
@ -212,7 +212,7 @@ export function on(event: "suspend", callback: (args: ApplicationEventData) => v
export function on(event: "resume", callback: (args: ApplicationEventData) => void, thisArg?: any);
/**
* This event is raised when the Application is about to exitEvent.
* This event is raised when the Application is about to exit.
*/
export function on(event: "exit", callback: (args: ApplicationEventData) => void, thisArg?: any);
@ -285,7 +285,7 @@ export interface AndroidActivityRequestPermissionsEventData extends AndroidActiv
requestCode: number;
/**
* The Permissions
* The Permissions.
*/
permissions: Array<string>;
@ -425,7 +425,7 @@ export class AndroidApplication extends Observable {
on(event: "activityBackPressed", callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any);
/**
* This event is raised on the back button is pressed in an android application.
* This event is raised when the Android activity requests permissions.
*/
on(event: "activityRequestPermissions", callback: (args: AndroidActivityRequestPermissionsEventData) => void, thisArg?: any);

View File

@ -25,14 +25,14 @@ export enum connectionType {
wifi = 1,
/**
* Denotes a mobile connection, i.e. cellular network or WAN
* Denotes a mobile connection, i.e. cellular network or WAN.
*/
mobile = 2
}
/**
* Starts monitoring the connection type.
* @param connectionChangedCallback A function that will be called when the connection type changes.
* @param connectionTypeChangedCallback A function that will be called when the connection type changes.
*/
export function startMonitoring(connectionTypeChangedCallback: (newConnectionType: number) => void): void;

View File

@ -38,14 +38,16 @@ export class FileSystemAccess {
/**
* Gets all entities of a given path (folder)
* @param onSuccess A callback function to call if operation is successful
* @param path Path to the file.
* @param onError (optional) A callback function to use if any error occurs.
* Returns an array of entities in the folder.
*/
getEntities(path: string, onError?: (error: any) => any): Array<{ path: string; name: string; extension: string }>;
/**
* Performs an action onSuccess for every entity in a folder with a given path.
* Breaks the loop if onSuccess function returns false
* @param path Path to the file.
* @param onEntity A callback function which is called for each entity.
* @param onError (optional) A callback function to use if any error occurs.
*/
@ -76,7 +78,7 @@ export class FileSystemAccess {
deleteFolder(path: string, onError?: (error: any) => any);
/**
* Deletes a content of a folder with a given path.
* Deletes all content of a folder with a given path.
* @param path Path of the folder.
* @param onError (optional) A callback function to use if any error occurs.
*/
@ -97,7 +99,7 @@ export class FileSystemAccess {
getDocumentsFolderPath(): string;
/**
* Gets the special documents folder.
* Gets the special temp folder.
* Returns for Android: "/data/data/applicationPackageName/cache", iOS: "/var/mobile/Applications/appID/Library/Caches"
*/
getTempFolderPath(): string;
@ -116,17 +118,17 @@ export class FileSystemAccess {
/**
* Reads a text from a file with a given path.
* @param path The path to the source file.
* @param onSuccess A callback function which is called when a text is red.
* @param onError (optional) A callback function to use if any error occurs.
* @param encoding (optional) If set reads the text with the specified encoding (default UTF-8).
* Returns the text read.
*/
readText(path: string, onError?: (error: any) => any, encoding?: any): string;
/**
* Reads a binary content from a file with a given path.
* @param path The path to the source file.
* @param onSuccess A callback function which is called when a text is red.
* @param onError (optional) A callback function to use if any error occurs.
* Returns the binary content read.
*/
read(path: string, onError?: (error: any) => any): any;
@ -134,7 +136,6 @@ export class FileSystemAccess {
* Writes a text to a file with a given path.
* @param path The path to the source file.
* @param content The content which will be written to the file.
* @param onSuccess (optional) A callback function which is called when a text is written.
* @param onError (optional) A callback function to use if any error occurs.
* @param encoding (optional) If set writes the text with the specified encoding (default UTF-8).
*/
@ -144,7 +145,6 @@ export class FileSystemAccess {
* Writes a binary to a file with a given path.
* @param path The path to the source file.
* @param content The content which will be written to the file.
* @param onSuccess (optional) A callback function which is called when a text is written.
* @param onError (optional) A callback function to use if any error occurs.
*/
write(path: string, content: any, onError?: (error: any) => any);
@ -168,14 +168,17 @@ export class FileSystemAccess {
normalizePath(path: string): string;
/**
* Join two paths (without normalize) only removes some trailing and dublicating path separators.
* Joins two paths (without normalize). Only removes some trailing and duplicate path separators.
* @param left First path to join.
* @param right Second path to join.
* Returns the joined path.
*/
joinPath(left: string, right: string): string;
/**
* Joins an array of file paths.
* @param paths An array of paths.
* Returns the joined path.
*/
joinPaths(paths: string[]): string;
}

View File

@ -19,7 +19,7 @@ export class ImageSource {
width: number;
/**
* Gets or sets the rotation angle that should be applied to image. (Used in android)
* Gets or sets the rotation angle that should be applied to the image. (Used in android)
*/
rotationAngle: number;
@ -76,13 +76,13 @@ export class ImageSource {
fromData(data: any): Promise<boolean>;
/**
* Loads this instance from the specified native image data.
* Loads this instance from the specified base64 encoded string.
* @param source The Base64 string to load the image from.
*/
loadFromBase64(source: string): boolean;
/**
* Loads this instance from the specified native image data asynchronously.
* Loads this instance from the specified base64 encoded string asynchronously.
* @param source The Base64 string to load the image from.
*/
fromBase64(source: string): Promise<boolean>;
@ -110,6 +110,10 @@ export class ImageSource {
toBase64String(format: "png" | "jpeg" | "jpg", quality?: number): string;
}
/**
* Creates a new ImageSource instance and loads it from the specified image asset asynchronously.
* @param asset The image asset.
*/
export function fromAsset(asset: imageAssetModule.ImageAsset): Promise<ImageSource>;
/**
@ -125,14 +129,14 @@ export function fromResource(name: string): ImageSource;
export function fromFile(path: string): ImageSource;
/**
* Creates a new ImageSource instance and loads it from the specified resource name.
* Creates a new ImageSource instance and loads it from the specified native image data.
* @param data The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.
*/
export function fromData(data: any): ImageSource;
/**
* Creates a new ImageSource instance and loads it from the specified resource name.
* @param source The Base64 string to load the image from.
* Creates a new ImageSource instance and loads it from the specified base64 encoded string.
* @param source The base64 encoded string to load the image from.
*/
export function fromBase64(source: string): ImageSource;
@ -150,7 +154,7 @@ export function fromNativeSource(source: any): ImageSource;
export function fromUrl(url: string): Promise<ImageSource>;
/**
* Creates a new ImageSource instance and loads it from the specified local file or resource(if spexified with "res://" prefix)
* Creates a new ImageSource instance and loads it from the specified local file or resource (if specified with the "res://" prefix).
* @param path The location of the file on the file system.
*/
export function fromFileOrResource(path: string): ImageSource;

View File

@ -40,7 +40,7 @@ export interface Device {
model: string;
/**
* Gets the model of the device.
* Gets the OS of the device.
* For example: "Android" or "iOS".
*/
os: string;
@ -52,32 +52,32 @@ export interface Device {
osVersion: string;
/**
* Gets the OS version.
* Gets the SDK version.
* For example: 19(android), 8.1(ios).
*/
sdkVersion: string;
/**
* Gets the type current device.
* Available values: "phone", "tablet".
* Gets the type of the current device.
* Available values: "Phone", "Tablet".
*/
deviceType: "Phone" | "Tablet";
/**
* Gets the uuid.
* On iOS this will return a new uuid if the application re-installed on the device.
* On iOS this will return a new uuid if the application is re-installed on the device.
* If you need to receive the same uuid even after the application has been re-installed on the device,
* use this plugin: https://www.npmjs.com/package/nativescript-ios-uuid
*/
uuid: string;
/**
* Gets the preferred language. For example "en"
* Gets the preferred language. For example "en" or "en-US".
*/
language: string;
/**
* Gets the preferred region. For example "US"
* Gets the preferred region. For example "US".
*/
region: string;
}
@ -123,6 +123,6 @@ export module screen {
}
/**
* Gets the current device information
* Gets the current device information.
*/
export var device: Device;

View File

@ -44,7 +44,7 @@ export enum GestureTypes {
}
/**
* Defines an enum with supported gesture types.
* Defines an enum with supported gesture states.
*/
export enum GestureStateTypes {
/**
@ -196,7 +196,7 @@ export interface Pointer {
}
/**
* Provides gesture event data for pinch gesture.
* Provides gesture event data.
*/
export interface GestureEventDataWithState extends GestureEventData {
state: number;

View File

@ -19,7 +19,7 @@ export class HtmlView extends View {
/**
* Gets the native [UILabel](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UILabel_Class/) that represents the user interface for this component. Valid only when running on iOS.
*/
ios: any /* UILabel */;
ios: any /* UITextView */;
/**
* Gets or sets html string for the HtmlView.

View File

@ -31,7 +31,7 @@ export class Image extends View {
src: any;
/**
* Gets a value indicating if the image is currently loading
* Gets a value indicating if the image is currently loading.
*/
readonly isLoading: boolean;

View File

@ -9,12 +9,12 @@ import { LayoutBase, View, Property } from "../layout-base";
*/
export class DockLayout extends LayoutBase {
/**
* Gets the value of the Left property from a given View.
* Gets the value of the Dock property from a given View.
*/
static getDock(view: View): Dock;
/**
* Sets the value of the Left property from a given View.
* Sets the value of the Dock property from a given View.
*/
static setDock(view: View, value: Dock): void;

View File

@ -35,7 +35,7 @@ export class ItemSpec {
isAuto: boolean;
/**
* Returns true if this ItemSpec instance holds weighted propertion
* Returns true if this ItemSpec instance holds weighted proportion
* of available space.
*/
isStar: boolean;
@ -107,7 +107,7 @@ export class GridLayout extends LayoutBase {
public removeColumn(itemSpec: ItemSpec): void;
/**
* Removes all columns specification from a GridLayout.
* Removes all column specifications from a GridLayout.
*/
public removeColumns(): void;
@ -117,7 +117,7 @@ export class GridLayout extends LayoutBase {
public removeRow(itemSpec: ItemSpec): void;
/**
* Removes all rows specification from a GridLayout.
* Removes all row specifications from a GridLayout.
*/
public removeRows(): void;

View File

@ -61,8 +61,8 @@ export class ListView extends View {
/**
* A function that returns the appropriate ket template based on the data item.
*/
itemTemplateSelector: string | ((item: any, index: number, items: any) => string);
/**
* Gets or set the items separator line color of the ListView.
*/

View File

@ -324,7 +324,7 @@ backgroundSpanUnderStatusBarProperty.register(PageBase);
/**
* Dependency property used to control if swipe back navigation in iOS is enabled.
* This property is iOS sepecific. Default value: true
* This property is iOS specific. Default value: true
*/
export const enableSwipeBackNavigationProperty = new Property<PageBase, boolean>({ name: "enableSwipeBackNavigation", defaultValue: true, valueConverter: booleanConverter });
enableSwipeBackNavigationProperty.register(PageBase);

View File

@ -104,7 +104,7 @@ export class Page extends ContentView {
public actionBarHidden: boolean;
/**
* Used to control if swipe back navigation in iOS is enabled. This property is iOS sepecific. Default value: true
* Used to control if swipe back navigation in iOS is enabled. This property is iOS specific. Default value: true
*/
public enableSwipeBackNavigation: boolean;
@ -278,7 +278,7 @@ export const actionBarHiddenProperty: Property<Page, boolean>;
/**
* Dependency property used to control if swipe back navigation in iOS is enabled.
* This property is iOS sepecific. Default value: true
* This property is iOS specific. Default value: true
*/
export const enableSwipeBackNavigationProperty: Property<Page, boolean>;

View File

@ -68,7 +68,7 @@ export class SearchBar extends View {
on(event: "close", callback: (args: EventData) => void, thisArg?: any);
/**
* Hides the soft input method, ususally a soft keyboard.
* Hides the soft input method, usually a soft keyboard.
*/
dismissSoftInput(): void;
}

View File

@ -130,5 +130,5 @@ export const tabTextColorProperty: CssProperty<Style, Color>;
export const tabBackgroundColorProperty: CssProperty<Style, Color>;
export const selectedTabTextColorProperty: CssProperty<Style, Color>;
export const androidSelectedTabHighlightColorProperty: CssProperty<Style, Color>;
export const androidOffscreenTabLimitProperty: Property<TabView, number>
export const androidOffscreenTabLimitProperty: Property<TabView, number>;
export const iosIconRenderingModeProperty: Property<TabView, "automatic" | "alwaysOriginal" | "alwaysTemplate">;

View File

@ -70,7 +70,7 @@ export class WebView extends View {
goForward();
/**
* Reload the current url.
* Reloads the current url.
*/
reload();
@ -101,10 +101,12 @@ export interface LoadEventData extends EventData {
* Gets the url of the web-view.
*/
url: string;
/**
* Gets the navigation type of the web-view.
*/
navigationType: NavigationType;
/**
* Gets the error (if any).
*/

View File

@ -41,36 +41,43 @@ export module layout {
export var UNSPECIFIED: number;
export var EXACTLY: number;
export var AT_MOST: number;
/**
* Gets measure specification mode from a given specification as string.
* Gets layout 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(px: number, mode: number): number;
/**
* Gets display density for the current device.
*/
export function getDisplayDensity(): number;
/**
* Convert device independent pixels to device pixels - dip to px.
* @param value - The pixel to convert.
*/
export function toDevicePixels(value: dip): px;
/**
* Convert device pixels to device independent pixels - px to dip.
* @param value - The pixel to convert.
@ -79,7 +86,7 @@ export module layout {
/**
* Rounds value used in layout.
* @param value to round.
* @param px to round.
*/
export function round(px: px): px;
@ -121,12 +128,12 @@ export module ad {
export function getInputMethodManager(): any /* android.view.inputmethod.InputMethodManager */;
/**
* Hides the soft input method, ususally a soft keyboard.
* Hides the soft input method, usually a soft keyboard.
*/
export function dismissSoftInput(nativeView?: any /* android.view.View */): void;
/**
* Shows the soft input method, ususally a soft keyboard.
* Shows the soft input method, usually a soft keyboard.
*/
export function showSoftInput(nativeView: any /* android.view.View */): void;
@ -139,6 +146,7 @@ export module ad {
* @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.
@ -155,6 +163,7 @@ export module ad {
* @param name - Name of the resource.
*/
export function getDrawableId(name);
/**
* Gets the string id from a given name.
* @param name - Name of the resource.
@ -206,9 +215,10 @@ export module ios {
* @param str - JavaScript string array to convert.
*/
export function jsArrayToNSArray(str: string[]): any;
/**
* Converts NSArray to JavaScript array.
* @param str - NSArray to convert.
* @param a - NSArray to convert.
*/
export function nsArrayToJSArray(a: any): string[];
}
@ -217,6 +227,7 @@ export module ios {
* 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).
*/
@ -265,14 +276,13 @@ export function escapeRegexSymbols(source: string): string
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).
* Sorts an array by using merge sort algorithm (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>
/**
*
* Checks if array has any duplicate elements.
* @param arr - The array to be checked.
*/