work to extend the definitions for WinJS and WinRT

This commit is contained in:
Adam Hewitt
2014-01-04 11:56:15 -08:00
parent 1fd738c346
commit b0d6f6912e
2 changed files with 147 additions and 50 deletions
+121 -34
View File
@@ -15,37 +15,55 @@ and limitations under the License.
declare module WinJS {
function strictProcessing(): void;
export module Application {
export var onsettings: EventListener;
}
module Binding {
function as(data: any): any;
class List {
constructor(data?: any[]);
public push(item: any): any;
public indexOf(item: any): number;
public splice(start: number, howMany?: number, item?: any[]): any[];
public createFiltered(predicate: (x: any) => boolean): List;
public createGrouped(keySelector: (x: any) => any, dataSelector: (x:any) => any, groupSorter: (left:any, right:any) => number): List;
public groups: any;
function processAll(rootElement?: any, dataContext?: any, skipRoot?: boolean, bindingCache?: any): any;
function define(data: any): any;
function expandProperties(data: any): any;
function converter(method: any): any;
export var optimizeBindingReferences: boolean;
export var mixin;
export var bind;
export var oneTime;
export function initializer(customInit): any;
export var setAttribute;
class List<T> {
constructor(data?: T[], options?: { binding: boolean; proxy: boolean; });
public push(item: T): number;
public indexOf(item: T, fromIndex?: number): number;
public splice(start: number, howMany?: number, ...items: T[]): T[];
public createFiltered(predicate: (x: T) => boolean): List<T>;
public createGrouped<U>(keySelector: (x: T) => string, dataSelector: (x:T) => U, groupSorter: (left:string, right:string) => number): List<T>;
public createSorted(sorter: (left:T, right:T) => number);
public groups: List<any>;
public dataSource: any;
public getAt(index: number): any;
public createSorted(sorter: (left, right) => number);
public forEach(callback: (val: any, index: number, array: any[]) => void, thisArg?: any);
public every(callback: (val: any, index: number, array: any[]) => boolean, thisArg?: any): boolean;
public getAt(index: number): T;
public forEach(callback: (val: T, index: number, array: T[]) => void, thisArg?: any);
public every(callback: (val: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
public join(separator: string): string;
public map(callback: (val: any, index: number, array: any[]) => any, thisArg?: any): any[];
public map<U>(callback: (val: T, index: number, array: T[]) => U, thisArg?: any): U[];
public move(index: number, newIndex: number);
public pop(): any;
public pop(): T;
public reduce(callback: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any;
public reduceRight(callback: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any;
public reverse();
public setAt(index: number, newValue: number);
public shift(): any;
public slice(begin: number, end: number): WinJS.Binding.List;
public some(callback: (val: any, index: number, array: any[]) => boolean, thisArg?: any): boolean;
public sort(sortFunction: (left, right) => number);
public unshift(value: any): number;
public setAt(index: number, newValue: T);
public shift(): T;
public slice(begin: number, end: number): List<T>;
public some(callback: (val: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
public sort(sortFunction: (left: T, right: T) => number);
public filter(callback: (val: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
public unshift(value: T): number;
public length: number;
public notifyMutated(index: number);
public notifyMutated(index: number);
}
class Template {
public element: HTMLElement;
@@ -73,7 +91,7 @@ declare module WinJS {
module Class {
function define(constructor: any, instanceMembers: any): any;
function derive(baseClass: any, constructor: any, instanceMembers: any): any;
function mix(constructor: any, mixin: any): any;
function mix(constructor: any, ...mixin: any[]): any;
}
function xhr(options: { type?: string; url?: string; user?: string; password?: string; headers?: any; data?: any; responseType?: string; }): WinJS.Promise<XMLHttpRequest>;
module Application {
@@ -100,15 +118,21 @@ declare module WinJS {
class ErrorFromName {
constructor(name: string, message?: string);
}
class Promise<T> {
class Promise<T> implements Windows.Foundation.IPromise<T> {
constructor(init: (c: any, e: any, p: any) => void);
then<U>(success?: (value: T) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void ): Promise<U>;
then<U>(success?: (value: T) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void ): Promise<U>;
then<U>(success?: (value: T) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void ): Promise<U>;
then<U>(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Promise<U>;
then<U>(success?: (value: T) => Windows.Foundation.IPromise<U>, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>;
then<U>(success?: (value: T) => Windows.Foundation.IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>;
then<U>(success?: (value: T) => U, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>;
then<U>(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>;
done<U>(success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void;
static join: any;
static timeout: any;
cancel(): void;
static join(values: any[]): Promise<any[]>;
static timeout(timeout: number): Promise<void>;
static as(): Promise<any>;
static as<U>(obj: U): Promise<U>;
static wrapError<U>(obj: U): Promise<U>;
}
module Navigation {
var history: any;
@@ -126,9 +150,23 @@ declare module WinJS {
var onnavigated: CustomEvent;
var onnavigating: CustomEvent;
}
export module Resources {
export var processAll: (element?: HTMLElement) => void;
export var getString: (id: string) => { value: string; empty?: boolean; lang?: string; };
export var addEventListener: (id: string, handler: EventListener, useCapture?: boolean) => void;
}
module Utilities {
function markSupportedForProcessing(obj: any): void;
enum Key {
function markSupportedForProcessing<T>(obj: T): T;
function createEventProperties(...events: string[]): any;
export function addClass(element: HTMLElement, className: string): void;
export function removeClass(element: HTMLElement, className: string): void;
export function hasClass(element: HTMLElement, className: string): boolean;
enum Key {
backspace,
tab,
enter,
@@ -235,9 +273,58 @@ declare module WinJS {
var ListLayout: any;
var GridLayout: any;
var Pages: any;
var Menu: any;
var setOptions: any;
var setOptions: any;
export var Animation: any;
var DOMEventMixin: any;
class Flyout {
constructor(element: HTMLElement, options);
element: Element;
}
module Fragments {
var renderCopy: any;
}
export class HtmlControl {
constructor(element: HTMLElement, options: { uri: string; });
}
interface IItem {
data: any;
}
interface ISelection {
clear(): WinJS.Promise<void>;
count();
getItems(): WinJS.Promise<IItem[]>;
}
class ListView {
element: Element;
elementFromIndex(index: number);
indexOfElement(element: Element);
selection: ISelection;
}
class Menu {
constructor(element: HTMLElement, options);
element: Element;
}
export class MenuCommand {
constructor(element: HTMLElement, options);
}
export class SettingsFlyout {
static populateSettings(e: any): any;
static showSettings(id: string, path: any): any;
}
}
export function xhr(options: { type: string; url: string; }): WinJS.Promise<any>; // user: string; password: string; headers: any; data: any; responseType: string;
}
interface Element {
+26 -16
View File
@@ -496,6 +496,14 @@ declare module Windows {
close(): void;
}
export interface IAsyncAction extends Windows.Foundation.IAsyncInfo {
then<U>(success?: () => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
then<U>(success?: () => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
then<U>(success?: () => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
then<U>(success?: () => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
done? <U>(success?: () => any, error?: (error: any) => any, progress?: (progress: any) => void): void;
cancel();
completed: Windows.Foundation.AsyncActionCompletedHandler;
getResults(): void;
}
@@ -521,7 +529,7 @@ declare module Windows {
export interface AsyncActionWithProgressCompletedHandler<TProgress> {
(asyncInfo: Windows.Foundation.IAsyncActionWithProgress<TProgress>, asyncStatus: Windows.Foundation.AsyncStatus): void;
}
export interface IAsyncActionWithProgress<TProgress> extends Windows.Foundation.IAsyncInfo {
export interface IAsyncActionWithProgress<TProgress> extends Windows.Foundation.IAsyncInfo, Windows.Foundation.IPromise<void> {
progress: Windows.Foundation.AsyncActionProgressHandler<TProgress>;
completed: Windows.Foundation.AsyncActionWithProgressCompletedHandler<TProgress>;
getResults(): void;
@@ -3301,11 +3309,11 @@ declare module Windows {
getResults(): void;
cancel(): void;
close(): void;
then<U>(success: (value: any) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise<U>;
then<U>(success: (value: any) => Windows.Foundation.IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise<U>;
then<U>(success: (value: any) => U, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void ): Windows.Foundation.IPromise<U>;
then<U>(success: (value: any) => Windows.Foundation.IPromise<U>, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void ): Windows.Foundation.IPromise<U>;
done<U>(success: (value: any) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void;
then<U>(success?: () => Windows.Foundation.IPromise<U>, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>;
then<U>(success?: () => Windows.Foundation.IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>;
then<U>(success?: () => U, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>;
then<U>(success?: () => U, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>;
done<U>(success?: () => any, error?: (error: any) => any, progress?: (progress: any) => void): void ;
operation: {
completed: Windows.Foundation.AsyncOperationCompletedHandler<any>;
getResults(): any;
@@ -8385,11 +8393,11 @@ declare module Windows {
getResults(): void;
cancel(): void;
close(): void;
then<U>(success: (value: any) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise<U>;
then<U>(success: (value: any) => Windows.Foundation.IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise<U>;
then<U>(success: (value: any) => U, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void ): Windows.Foundation.IPromise<U>;
then<U>(success: (value: any) => Windows.Foundation.IPromise<U>, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void ): Windows.Foundation.IPromise<U>;
done<U>(success: (value: any) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void;
then<U>(success?: () => Windows.Foundation.IPromise<U>, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>;
then<U>(success?: () => Windows.Foundation.IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>;
then<U>(success?: () => U, error?: (error: any) => Windows.Foundation.IPromise<U>, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>;
then<U>(success?: () => U, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise<U>;
done<U>(success?: () => any, error?: (error: any) => any, progress?: (progress: any) => void): void;
operation: {
completed: Windows.Foundation.AsyncOperationCompletedHandler<any>;
getResults(): any;
@@ -14635,10 +14643,12 @@ declare module Windows {
}
declare module Windows.Foundation {
export interface IPromise<T> {
then<U>(success?: (value: T) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void ): Windows.Foundation.IPromise<U>;
then<U>(success?: (value: T) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise<U>;
then<U>(success?: (value: T) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void ): Windows.Foundation.IPromise<U>;
then<U>(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise<U>;
done?<U>(success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void;
then<U>(success?: (value: T) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void ): IPromise<U>;
then<U>(success?: (value: T) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void ): IPromise<U>;
then<U>(success?: (value: T) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void ): IPromise<U>;
then<U>(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): IPromise<U>;
done?<U>(success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void): void;
cancel(): void;
}
}