mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +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
@ -1,96 +1,94 @@
|
||||
/**
|
||||
* Contains the VirtualArray class, which is an advanced array like class that helps loading items on demand.
|
||||
*/
|
||||
declare module "data/virtual-array" {
|
||||
import * as observable from "data/observable";
|
||||
import * as observableArray from "data/observable-array";
|
||||
import * as observable from "data/observable";
|
||||
import * as observableArray from "data/observable-array";
|
||||
|
||||
/**
|
||||
* Provides event args for "changed" event.
|
||||
*/
|
||||
export interface ChangedData<T> extends observableArray.ChangedData<T> {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Change types (Add, Delete, Update, Splice).
|
||||
*/
|
||||
export class ChangeType extends observableArray.ChangeType {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Advanced array like class that helps loading items on demand.
|
||||
*/
|
||||
export class VirtualArray<T> extends observable.Observable {
|
||||
/**
|
||||
* String value used when hooking to change event.
|
||||
*/
|
||||
public static changeEvent: string;
|
||||
|
||||
/**
|
||||
* Provides event args for "changed" event.
|
||||
* String value used when hooking to itemsLoading event.
|
||||
*/
|
||||
export interface ChangedData<T> extends observableArray.ChangedData<T> {
|
||||
//
|
||||
}
|
||||
public static itemsLoadingEvent: string;
|
||||
|
||||
constructor(arrayLength?: number);
|
||||
|
||||
/**
|
||||
* Change types (Add, Delete, Update, Splice).
|
||||
* Gets or sets length for the virtual array.
|
||||
*/
|
||||
export class ChangeType extends observableArray.ChangeType {
|
||||
//
|
||||
}
|
||||
length: number;
|
||||
|
||||
/**
|
||||
* Advanced array like class that helps loading items on demand.
|
||||
* Gets or sets load size for the virtual array.
|
||||
*/
|
||||
export class VirtualArray<T> extends observable.Observable {
|
||||
/**
|
||||
* String value used when hooking to change event.
|
||||
*/
|
||||
public static changeEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to itemsLoading event.
|
||||
*/
|
||||
public static itemsLoadingEvent: string;
|
||||
|
||||
constructor(arrayLength?: number);
|
||||
|
||||
/**
|
||||
* Gets or sets length for the virtual array.
|
||||
*/
|
||||
length: number;
|
||||
|
||||
/**
|
||||
* Gets or sets load size for the virtual array.
|
||||
*/
|
||||
loadSize: number;
|
||||
|
||||
/**
|
||||
* Returns item at specified index.
|
||||
*/
|
||||
getItem(index: number): T;
|
||||
|
||||
/**
|
||||
* Sets item at specified index.
|
||||
*/
|
||||
setItem(index: number, value: T): void;
|
||||
|
||||
/**
|
||||
* Loads items from an array starting at index.
|
||||
*/
|
||||
load(index: number, items: T[]): void;
|
||||
|
||||
/**
|
||||
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
|
||||
* @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
|
||||
* @param callback - Callback function which will be executed when event is raised.
|
||||
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
|
||||
*/
|
||||
on(eventNames: string, callback: (data: observable.EventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* Raised when still not loaded items are requested.
|
||||
*/
|
||||
on(event: "itemsLoading", callback: (args: ItemsLoading) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* Raised when a change occurs.
|
||||
*/
|
||||
on(event: "change", callback: (args: ChangedData<T>) => void, thisArg?: any);
|
||||
}
|
||||
loadSize: number;
|
||||
|
||||
/**
|
||||
* Event args for "itemsLoading" event.
|
||||
* Returns item at specified index.
|
||||
*/
|
||||
export interface ItemsLoading extends observable.EventData {
|
||||
/**
|
||||
* Start index.
|
||||
*/
|
||||
index: number;
|
||||
getItem(index: number): T;
|
||||
|
||||
/**
|
||||
* Number of items to load.
|
||||
*/
|
||||
count: number;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sets item at specified index.
|
||||
*/
|
||||
setItem(index: number, value: T): void;
|
||||
|
||||
/**
|
||||
* Loads items from an array starting at index.
|
||||
*/
|
||||
load(index: number, items: T[]): void;
|
||||
|
||||
/**
|
||||
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
|
||||
* @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
|
||||
* @param callback - Callback function which will be executed when event is raised.
|
||||
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
|
||||
*/
|
||||
on(eventNames: string, callback: (data: observable.EventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* Raised when still not loaded items are requested.
|
||||
*/
|
||||
on(event: "itemsLoading", callback: (args: ItemsLoading) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* Raised when a change occurs.
|
||||
*/
|
||||
on(event: "change", callback: (args: ChangedData<T>) => void, thisArg?: any);
|
||||
}
|
||||
|
||||
/**
|
||||
* Event args for "itemsLoading" event.
|
||||
*/
|
||||
export interface ItemsLoading extends observable.EventData {
|
||||
/**
|
||||
* Start index.
|
||||
*/
|
||||
index: number;
|
||||
|
||||
/**
|
||||
* Number of items to load.
|
||||
*/
|
||||
count: number;
|
||||
}
|
||||
|
Reference in New Issue
Block a user