This commit is contained in:
T.J. Lawrence
2014-01-20 08:58:43 -07:00
10 changed files with 159 additions and 146 deletions

View File

@@ -1,6 +1,6 @@
// Type definitions for EaselJS 0.7.0, TweenJS 0.5.0, SoundJS 0.5.0, PreloadJS 0.4.0
// Type definitions for EaselJS 0.7.1, TweenJS 0.5.1, SoundJS 0.5.2, PreloadJS 0.4.1
// Project: http://www.createjs.com/#!/EaselJS
// Definitions by: Pedro Ferreira <https://bitbucket.org/drk4>
// Definitions by: Pedro Ferreira <https://bitbucket.org/drk4>, Chris Smith <https://github.com/evilangelist>, Satoru Kimura <https://github.com/gyohk>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/*
@@ -23,13 +23,13 @@ declare module createjs {
// properties
bubbles: boolean;
cancelable: boolean;
currentTarget: Object;
currentTarget: any; // It is 'Object' type officially, but 'any' is easier to use.
defaultPrevented: boolean;
eventPhase: number;
immediatePropagationStopped: boolean;
propagationStopped: boolean;
removed: boolean;
target: Object;
target: any; // It is 'Object' type officially, but 'any' is easier to use.
timeStamp: number;
type: string;
@@ -38,15 +38,15 @@ declare module createjs {
delta: number;
error: string;
id: string;
item: any;
loaded: number;
item: any;
loaded: number;
name: string;
next: string;
params: any[];
params: any;
paused: boolean;
progress: number;
rawResult: Object;
result: Object;
rawResult: any;
result: any;
runTime: number;
src: string;
time: number;
@@ -78,16 +78,19 @@ declare module createjs {
off(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
off(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
off(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
on(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function;
on(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function;
on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): Object;
on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): Object;
off(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
on(type: string, listener: (eventObj: Object) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
on(type: string, listener: (eventObj: Object) => void, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
removeAllEventListeners(type?: string): void;
removeEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void;
removeEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
removeEventListener(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
toString(): string;
willTrigger(type: string): boolean;
}
export function indexOf(array: any[], searchElement: Object): number;

View File

@@ -53,4 +53,16 @@ function test_graphics() {
var myGraphics: createjs.Graphics;
myGraphics.beginStroke("#F00").beginFill("#00F").drawRect(20, 20, 100, 50).draw(myContext2D);
}
function colorMatrixTest() {
var shape = new createjs.Shape().set({ x: 100, y: 100 });
shape.graphics.beginFill("#ff0000").drawCircle(0, 0, 50);
var matrix = new createjs.ColorMatrix().adjustHue(180).adjustSaturation(100);
shape.filters = [
new createjs.ColorMatrixFilter(matrix)
];
shape.cache(-50, -50, 100, 100);
}

121
easeljs/easeljs.d.ts vendored
View File

@@ -1,4 +1,4 @@
// Type definitions for EaselJS 0.7.0
// Type definitions for EaselJS 0.7.1
// Project: http://www.createjs.com/#!/EaselJS
// Definitions by: Pedro Ferreira <https://bitbucket.org/drk4>, Chris Smith <https://github.com/evilangelist>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -55,6 +55,8 @@ declare module createjs {
// methods
clone(): Bitmap;
set(props: Object): Bitmap;
setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Bitmap;
}
/**
@@ -73,6 +75,9 @@ declare module createjs {
spriteSheet: SpriteSheet;
text: string;
// methods
set(props: Object): BitmapText;
setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): BitmapText;
}
export class BlurFilter extends Filter {
@@ -120,12 +125,8 @@ declare module createjs {
clone(): ColorFilter;
}
export class ColorMatrix implements Array<number> {
constructor(brightness: number, contrast: number, saturation: number, hue: number);
static DELTA_INDEX: number[];
static IDENTITY_MATRIX: number[];
static LENGTH: number;
export class ColorMatrix {
constructor(brightness?: number, contrast?: number, saturation?: number, hue?: number);
// methods
adjustBrightness(value: number): ColorMatrix;
@@ -135,41 +136,17 @@ declare module createjs {
adjustSaturation(value: number): ColorMatrix;
clone(): ColorMatrix;
concat(...matrix: number[]): ColorMatrix;
copyMatrix(...matrix: ColorMatrix[]): ColorMatrix;
concat(matrix: ColorMatrix): ColorMatrix;
copyMatrix(...matrix: number[]): ColorMatrix;
copyMatrix(matrix: ColorMatrix): ColorMatrix;
reset(): ColorMatrix;
toArray(): number[];
// implements Array interface start
concat<ColorMatrix>(...items: ColorMatrix[]): number[];
join(separator?: string): string;
pop(): number;
push(...items: number[]): number;
reverse(): number[];
shift(): number;
slice(start: number, end?: number): number[];
sort(compareFn?: (a: number, b: number) => number): number[];
splice(start: number): number[];
unshift(...items: number[]): number;
indexOf(searchElement: number, fromIndex?: number): number;
lastIndexOf(searchElement: number, fromIndex?: number): number;
every(callbackfn: (value: number, index: number, array: number[]) => boolean, thisArg?: any): boolean;
some(callbackfn: (value: number, index: number, array: number[]) => boolean, thisArg?: any): boolean;
forEach(callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any): void;
map<ColorMatrix>(callbackfn: (value: number, index: number, array: number[]) => ColorMatrix, thisArg?: any): ColorMatrix[];
filter(callbackfn: (value: number, index: number, array: number[]) => boolean, thisArg?: any): number[];
reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue?: number): number;
reduce<ColorMatrix>(callbackfn: (previousValue: ColorMatrix, currentValue: number, currentIndex: number, array: number[]) => ColorMatrix, initialValue: ColorMatrix): ColorMatrix;
reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue?: number): number;
reduceRight<ColorMatrix>(callbackfn: (previousValue: ColorMatrix, currentValue: number, currentIndex: number, array: number[]) => ColorMatrix, initialValue: ColorMatrix): ColorMatrix;
length: number;
[n: number]: number;
// implements Array interface end
toString(): string;
}
export class ColorMatrixFilter extends Filter {
constructor(matrix: number[]);
constructor(matrix: ColorMatrix);
// methods
clone(): ColorMatrixFilter;
@@ -177,7 +154,7 @@ declare module createjs {
export class Command {
// methods
constructor(f: any, params: any, path: any);
constructor(f: any, params: any, path?: any);
exec(scope: any): void;
}
@@ -187,6 +164,7 @@ declare module createjs {
// properties
children: DisplayObject[];
mouseChildren: boolean;
tickChildren: boolean;
// methods
addChild(...child: DisplayObject[]): DisplayObject;
@@ -203,7 +181,9 @@ declare module createjs {
removeAllChildren(): void;
removeChild(...child: DisplayObject[]): boolean;
removeChildAt(...index: number[]): boolean;
set(props: Object): Container;
setChildIndex(child: DisplayObject, index: number): void;
setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Container;
sortChildren(sortFunction: (a: DisplayObject, b: DisplayObject) => number): void;
swapChildren(child1: DisplayObject, child2: DisplayObject): void;
swapChildrenAt(index1: number, index2: number): void;
@@ -214,7 +194,7 @@ declare module createjs {
// properties
alpha: number;
cacheCanvas: HTMLCanvasElement; // HTMLCanvasElement or Object
cacheCanvas: any; // HTMLCanvasElement or Object
cacheID: number;
compositeOperation: string;
cursor: string;
@@ -238,6 +218,7 @@ declare module createjs {
*/
snapToPixel: boolean;
static suppressCrossDomainErrors: boolean;
tickEnabled: boolean;
visible: boolean;
x: number;
y: number;
@@ -274,7 +255,8 @@ declare module createjs {
// methods
clone(): DisplayObject; // throw error
set(props: Object): DOMElement;
setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): DOMElement;
}
@@ -425,6 +407,8 @@ declare module createjs {
constructor(type: string, bubbles: boolean, cancelable: boolean, stageX: number, stageY: number, nativeEvent: NativeMouseEvent, pointerID: number, primary: boolean, rawX: number, rawY: number);
// properties
localX: number;
localY: number;
nativeEvent: NativeMouseEvent;
pointerID: number;
primary: boolean;
@@ -432,7 +416,6 @@ declare module createjs {
rawY: number;
stageX: number;
stageY: number;
target: DisplayObject;
// methods
clone(): MouseEvent;
@@ -442,23 +425,27 @@ declare module createjs {
addEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function;
addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): Object;
addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): Object;
on(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function;
on(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function;
on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): Object;
on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): Object;
removeEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void;
removeEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
dispatchEvent(eventObj: Object, target?: Object): boolean;
dispatchEvent(eventObj: string, target?: Object): boolean;
dispatchEvent(eventObj: Event, target?: Object): boolean;
hasEventListener(type: string): boolean;
off(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void;
off(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
off(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
off(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
off(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
on(type: string, listener: (eventObj: Object) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
on(type: string, listener: (eventObj: Object) => void, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
removeAllEventListeners(type?: string): void;
dispatchEvent(eventObj: string, target?: Object): boolean;
dispatchEvent(eventObj: Object, target?: Object): boolean;
dispatchEvent(eventObj: Event, target?: Object): boolean;
hasEventListener(type: string): boolean;
removeEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void;
removeEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
removeEventListener(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
toString(): string;
willTrigger(type: string): boolean;
}
@@ -555,6 +542,8 @@ declare module createjs {
// methods
clone(recursive?: boolean): Shape;
set(props: Object): Shape;
setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Shape;
}
@@ -583,6 +572,8 @@ declare module createjs {
gotoAndStop(frameOrAnimation: string): void;
gotoAndStop(frameOrAnimation: number): void;
play(): void;
set(props: Object): Sprite;
setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Sprite;
stop(): void;
}
@@ -619,6 +610,8 @@ declare module createjs {
export class SpriteSheetBuilder extends EventDispatcher {
constructor();
// properties
maxHeight: number;
maxWidth: number;
@@ -634,9 +627,9 @@ declare module createjs {
addMovieClip(source: MovieClip, sourceRect?: Rectangle, scale?: number): void;
build(): SpriteSheet;
buildAsync(timeSlice?: number): void;
clone(): DisplayObject; // throw error
clone(): void; // throw error
stopAsync(): void;
toString(): string;
}
@@ -660,7 +653,8 @@ declare module createjs {
// properties
autoClear: boolean;
canvas: HTMLCanvasElement;
canvas: any; // HTMLCanvasElement or Object
handleEvent: Function;
mouseInBounds: boolean;
mouseMoveOutside: boolean;
mouseX: number;
@@ -677,7 +671,6 @@ declare module createjs {
clone(): Stage;
enableDOMEvents(enable?: boolean): void;
enableMouseOver(frequency?: number): void;
handleEvent(evt: Object): void;
toDataURL(backgroundColor: string, mimeType: string): string;
update(...arg: any[]): void;
@@ -703,6 +696,8 @@ declare module createjs {
getMeasuredHeight(): number;
getMeasuredLineHeight(): number;
getMeasuredWidth(): number;
set(props: Object): Text;
setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Text;
}
export class Ticker {
@@ -731,7 +726,6 @@ declare module createjs {
static setFPS(value: number): void;
static setInterval(interval: number): void;
static setPaused(value: boolean): void;
static toString(): string;
// EventDispatcher mixins
static addEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function;
@@ -746,16 +740,19 @@ declare module createjs {
static off(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
static off(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
static off(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
static on(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function;
static on(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function;
static on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): Object;
static on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): Object;
static off(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
static on(type: string, listener: (eventObj: Object) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
static on(type: string, listener: (eventObj: Object) => void, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
static on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
static on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
static removeAllEventListeners(type?: string): void;
static removeEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void;
static removeEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
static removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
static removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
static removeEventListener(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
static toString(): string;
static willTrigger(type: string): boolean;
}
export class TickerEvent {

View File

@@ -592,6 +592,9 @@ source.addEventListener('message', <_.LoDashObjectWrapper<Function>>_(function()
'maxWait': 1000
}), false);
var returnedDebounce = _.throttle(function (a) { return a * 5; }, 5);
returnedThrottled(4);
result = <number>_.defer(function() { console.log('deferred'); });
result = <_.LoDashWrapper<number>>_(function() { console.log('deferred'); }).defer();
@@ -608,15 +611,20 @@ var data = {
'curly': { 'name': 'curly', 'age': 60 }
};
var stooge = <Function>_.memoize(function(name: string) { return data[name]; }, _.identity);
var stooge = _.memoize(function(name: string) { return data[name]; }, _.identity);
stooge('curly');
stooge['cache']['curly'].name = 'jerome';
stooge('curly');
var initialize = <Function>_.once(function(){ });
initialize();
var returnedMemoize = _.throttle(function (a) { return a * 5; }, 5);
returnedMemoize(4);
var initialize = _.once(function(){ });
initialize();
initialize();''
var returnedOnce = _.throttle(function (a) { return a * 5; }, 5);
returnedOnce(4);
var greetPartial = function(greeting: string, name: string) { return greeting + ' ' + name; };
var hi = <Function>_.partial(greetPartial, 'hi');
@@ -638,6 +646,9 @@ jQuery('.interactive').on('click', _.throttle(function() { }, 300000, {
'trailing': false
}));
var returnedThrottled = _.throttle(function (a) { return a*5; }, 5);
returnedThrottled(4);
var helloWrap = function(name: string) { return 'hello ' + name; };
var helloWrap2 = _.wrap(helloWrap, function(func) {
return 'before, ' + func('moe') + ', after';
@@ -950,9 +961,9 @@ class Mage {
}
var mage = new Mage();
result = <number[]>_.times(3, _.partial(_.random, 1, 6));
result = <number[]>_.times(3, function(n: number) { mage.castSpell(n); });
result = <number[]>_.times(3, function(n: number) { this.cast(n); }, mage);
result = _.times(3, <() => number>_.partial(_.random, 1, 6));
result = _.times(3, function(n: number) { mage.castSpell(n); });
result = _.times(3, function(n: number) { this.cast(n); }, mage);
result = <string>_.unescape('Moe, Larry &amp; Curly');

22
lodash/lodash.d.ts vendored
View File

@@ -2580,10 +2580,10 @@ declare module _ {
* @param options.trailing Specify execution on the trailing edge of the timeout.
* @return The new debounced function.
**/
debounce(
func: Function,
debounce<T extends Function>(
func: T,
wait: number,
options?: DebounceSettings): Function;
options?: DebounceSettings): T;
}
interface LoDashObjectWrapper<T> {
@@ -2670,9 +2670,9 @@ declare module _ {
* @param resolver Hash function for storing the result of `fn`.
* @return Returns the new memoizing function.
**/
memoize(
func: Function,
resolver?: (n: any) => string): Function;
memoize<T extends Function>(
func: T,
resolver?: (n: any) => string): T;
}
//_.once
@@ -2684,7 +2684,7 @@ declare module _ {
* @param func Function to only execute once.
* @return The new restricted function.
**/
once(func: Function): Function;
once<T extends Function>(func: T): T;
}
//_.partial
@@ -2733,10 +2733,10 @@ declare module _ {
* @param options.trailing Specify execution on the trailing edge of the timeout.
* @return The new throttled function.
**/
throttle(
func: any,
throttle<T extends Function>(
func: T,
wait: number,
options?: ThrottleSettings): Function;
options?: ThrottleSettings): T;
}
interface ThrottleSettings {
@@ -3764,7 +3764,7 @@ declare module _ {
**/
times<TResult>(
n: number,
callback: Function,
callback: (num: number) => TResult,
context?: any): TResult[];
}

View File

@@ -257,6 +257,7 @@ interface Contacts {
}
interface Device {
available: boolean;
name: string;
cordova: string;
platform: string;

View File

@@ -1,4 +1,4 @@
// Type definitions for PreloadJS 0.4.0
// Type definitions for PreloadJS 0.4.1
// Project: http://www.createjs.com/#!/PreloadJS
// Definitions by: Pedro Ferreira <https://bitbucket.org/drk4>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -22,16 +22,15 @@ declare module createjs {
progress: number;
// methods
buildPath(src: string, basePath?: string, data?: Object): string;
buildPath(src: string, data?: Object): string;
close(): void;
load(): void;
toString(): string;
}
export class LoadQueue extends AbstractLoader {
constructor(useXHR?: boolean, basePath?: string);
constructor(useXHR?: boolean, basePath?: string, crossOrigin?: string);
constructor(useXHR?: boolean, basePath?: string, crossOrigin?: boolean);
// properties
static BINARY: string;
static CSS: string;
@@ -39,8 +38,9 @@ declare module createjs {
static JAVASCRIPT: string;
static JSON: string;
static JSONP: string;
static LOAD_TIMEOUT: number;
static loadTimeout: number;
maintainScriptOrder: boolean;
static MANIFEST: string;
next: LoadQueue;
static SOUND: string;
stopOnError: boolean;
@@ -55,8 +55,9 @@ declare module createjs {
installPlugin(plugin: any): void;
loadFile(file: Object, loadNow?: boolean, basePath?: string): void;
loadFile(file: string, loadNow?: boolean, basePath?: string): void;
loadManifest(manifest: Object[], loadNow?: boolean, basePath?: string): void;
loadManifest(manifest: string[], loadNow?: boolean, basePath?: string): void;
loadManifest(manifest: Object, loadNow?: boolean, basePath?: string): void;
loadManifest(manifest: string, loadNow?: boolean, basePath?: string): void;
loadManifest(manifest: any[], loadNow?: boolean, basePath?: string): void;
remove(idsOrUrls: string): void;
remove(idsOrUrls: any[]): void;
removeAll(): void;
@@ -71,18 +72,21 @@ declare module createjs {
static version: string;
}
export class SamplePlugin {
static fileLoadHandler(event: Object): void;
static getPreloadHandlers(): Object;
static preloadHandler(src: string, type: string, id: string, data: any, basePath: string, queue: LoadQueue): any;
}
export class TagLoader extends AbstractLoader {
constructor (item: Object);
// properties
_isAudio: boolean;
// methods
getResult(): any;
}
export class XHRLoader extends AbstractLoader {
constructor (item: Object);
constructor (item: Object, crossOrigin?: string);
// methods
getAllResponseHeaders(): string;

View File

@@ -36,6 +36,7 @@ interface SignalR {
logging: boolean;
messageId: string;
url: string;
qs: any;
(url: string, queryString?: any, logging?: boolean): SignalR;
hubConnection(url?: string): SignalR;

57
soundjs/soundjs.d.ts vendored
View File

@@ -1,4 +1,4 @@
// Type definitions for SoundJS 0.5.0
// Type definitions for SoundJS 0.5.2
// Project: http://www.createjs.com/#!/SoundJS
// Definitions by: Pedro Ferreira <https://bitbucket.org/drk4>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -19,45 +19,29 @@ declare module createjs {
constructor();
// properties
static BASE_PATH: string;
static buildDate: string;
static capabilities: Object;
flashReady: boolean;
showOutput: boolean;
static swfPath: string;
static version: string;
// methods
create(src: string): SoundInstance;
flashLog(data: string): void;
getVolume(): number;
handleErrorEvent(error: string): void;
handleEvent(method: string): void;
handlePreloadEvent(flashId: string, method: string): void;
handleSoundEvent(flashId: string, method: string): void;
isPreloadStarted(src: string): boolean;
static isSupported(): boolean;
preload(src: string, instance: Object, basePath: string): void;
preload(src: string, instance: Object): void;
register(src: string, instances: number): Object;
registerPreloadInstance(flashId: string, instance: any): void;
registerSoundInstance(flashId: string, instance: any): void;
removeAllSounds (): void;
removeSound(src: string): void;
setMute(value: boolean): boolean;
setVolume(value: number): boolean;
unregisterPreloadInstance(flashId: string): void;
unregisterSoundInstance(flashId: string, instance: any): void;
toString(): string;
}
export class HTMLAudioPlugin {
constructor();
// properties
static AUDIO_ENDED: string;
static AUDIO_ERROR: string;
static AUDIO_READY: string;
static AUDIO_SEEKED: string;
static AUDIO_STALLED: string;
defaultNumChannels: number;
enableIOS: boolean;
static MAX_INSTANCES: number;
@@ -66,18 +50,17 @@ declare module createjs {
create(src: string): SoundInstance;
isPreloadStarted(src: string): boolean;
static isSupported(): boolean;
preload(src: string, instance: Object, basePath: string): void;
preload(src: string, instance: Object): void;
register(src: string, instances: number): Object;
removeAllSounds(): void;
removeSound(src: string): void;
toString(): string;
}
export class Sound {
// properties
static activePlugin: Object;
static alternateExtensions: any[];
static defaultInterruptBehavior: string;
static DELIMITER: string;
static EXTENSION_MAP: Object;
static INTERRUPT_ANY: string;
static INTERRUPT_EARLY: string;
@@ -102,18 +85,18 @@ declare module createjs {
static loadComplete(src: string): boolean;
static play(src: string, interrupt?: any, delay?: number, offset?: number, loop?: number, volume?: number, pan?: number): SoundInstance;
static registerManifest(manifest: any[], basePath: string): Object;
static registerPlugin(plugin: Object): boolean;
static registerPlugins(plugins: any[]): boolean;
static registerSound(src: string, id?: string, data?: number, preload?: boolean, basePath?: string): Object;
static registerSound(src: string, id?: string, data?: Object, preload?: boolean, basePath?: string): Object;
static registerSound(src: Object, id?: string, data?: number, preload?: boolean, basePath?: string): Object;
static registerSound(src: Object, id?: string, data?: Object, preload?: boolean, basePath?: string): Object;
static removeAllSounds(): void;
static removeManifest(manifest: any[]): Object;
static removeSound(src: string): boolean;
static removeSound(src: Object): boolean;
static removeManifest(manifest: any[], basePath: string): Object;
static removeSound(src: string, basePath: string): boolean;
static removeSound(src: Object, basePath: string): boolean;
static setMute(value: boolean): boolean;
static setVolume(value: number): void;
static stop(): void;
static toString(): string;
// EventDispatcher mixins
static addEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function;
@@ -128,16 +111,19 @@ declare module createjs {
static off(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
static off(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
static off(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
static on(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function;
static on(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function;
static on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): Object;
static on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): Object;
static off(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
static on(type: string, listener: (eventObj: Object) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
static on(type: string, listener: (eventObj: Object) => void, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
static on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
static on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
static removeAllEventListeners(type?: string): void;
static removeEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void;
static removeEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
static removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
static removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
static removeEventListener(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
static toString(): string;
static willTrigger(type: string): boolean;
}
export class SoundInstance extends EventDispatcher {
@@ -149,6 +135,7 @@ declare module createjs {
panNode: any;
playState: string;
sourceNode: any;
src: string;
uniqueId: any; //HERE string or number
volume: number;
@@ -191,15 +178,11 @@ declare module createjs {
isPreloadStarted(src: string): boolean;
static isSupported(): boolean;
playEmptySound(): void;
preload(src: string, instance: Object): void;
register(src: string, instances: number): Object;
removeAllSounds(src: string): void;
/**
* @deprecated
*/
removeFromPreload(src: string): void;
removeSound(src: string): void;
setMute(value: boolean): boolean;
setVolume(value: number): boolean;
toString(): string;
}
}

View File

@@ -1,4 +1,4 @@
// Type definitions for TweenJS 0.5.0
// Type definitions for TweenJS 0.5.1
// Project: http://www.createjs.com/#!/TweenJS
// Definitions by: Pedro Ferreira <https://bitbucket.org/drk4>, Chris Smith <https://github.com/evilangelist>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -82,7 +82,7 @@ declare module createjs {
static priority: any;
//methods
static init(tween: Tween, prop: string, value: any): any;
static init(tween: Tween, prop: string, value: any): any;
static step(tween: Tween, prop: string, startValue: any, injectProps: Object, endValue: any): void;
static install(): void;
static tween(tween: Tween, prop: string, value: any, startValues: Object, endValues: Object, ratio: number, wait: boolean, end: boolean): any;
@@ -100,8 +100,8 @@ declare module createjs {
// methods
addLabel(label: string, position: number): void;
addTween(...tween: Tween[]): void;
getCurrentLabel(): string;
getLabels(): Object[];
getCurrentLabel(): string;
getLabels(): Object[];
gotoAndPlay(positionOrLabel: string): void;
gotoAndPlay(positionOrLabel: number): void;
gotoAndStop(positionOrLabel: string): void;
@@ -148,6 +148,7 @@ declare module createjs {
setPaused(value: boolean): Tween;
setPosition(value: number, actionsMode: number): boolean;
static tick(delta: number, paused: boolean): void;
tick(delta: number, paused: boolean): void;
tick(delta: number): void;
to(props: Object, duration?: number, ease?: (t: number) => number): Tween;
wait(duration: number, passive?: boolean): Tween;