Skip to content

Commit

Permalink
update typings to include mini-signals
Browse files Browse the repository at this point in the history
  • Loading branch information
englercj committed Dec 21, 2018
1 parent 2f365fc commit e9c3c08
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 18 deletions.
10 changes: 5 additions & 5 deletions src/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class Loader {
*
* The callback looks like {@link Loader.OnProgressSignal}.
*
* @member {Signal}
* @member {Signal<Loader.OnProgressSignal>}
*/
this.onProgress = new Signal();

Expand All @@ -129,7 +129,7 @@ export class Loader {
*
* The callback looks like {@link Loader.OnErrorSignal}.
*
* @member {Signal}
* @member {Signal<Loader.OnErrorSignal>}
*/
this.onError = new Signal();

Expand All @@ -138,7 +138,7 @@ export class Loader {
*
* The callback looks like {@link Loader.OnLoadSignal}.
*
* @member {Signal}
* @member {Signal<Loader.OnLoadSignal>}
*/
this.onLoad = new Signal();

Expand All @@ -147,7 +147,7 @@ export class Loader {
*
* The callback looks like {@link Loader.OnStartSignal}.
*
* @member {Signal}
* @member {Signal<Loader.OnStartSignal>}
*/
this.onStart = new Signal();

Expand All @@ -156,7 +156,7 @@ export class Loader {
*
* The callback looks like {@link Loader.OnCompleteSignal}.
*
* @member {Signal}
* @member {Signal<Loader.OnCompleteSignal>}
*/
this.onComplete = new Signal();

Expand Down
8 changes: 4 additions & 4 deletions src/Resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export class Resource {
*
* The callback looks like {@link Resource.OnStartSignal}.
*
* @member {Signal}
* @member {Signal<Resource.OnStartSignal>}
*/
this.onStart = new Signal();

Expand All @@ -270,7 +270,7 @@ export class Resource {
*
* The callback looks like {@link Resource.OnProgressSignal}.
*
* @member {Signal}
* @member {Signal<Resource.OnProgressSignal>}
*/
this.onProgress = new Signal();

Expand All @@ -280,7 +280,7 @@ export class Resource {
*
* The callback looks like {@link Resource.OnCompleteSignal}.
*
* @member {Signal}
* @member {Signal<Resource.OnCompleteSignal>}
*/
this.onComplete = new Signal();

Expand All @@ -289,7 +289,7 @@ export class Resource {
*
* The callback looks like {@link Resource.OnCompleteSignal}.
*
* @member {Signal}
* @member {Signal<Resource.OnCompleteSignal>}
*/
this.onAfterMiddleware = new Signal();
}
Expand Down
26 changes: 26 additions & 0 deletions typings/mini-signals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
declare module "mini-signals"
{
namespace MiniSignal
{
interface MiniSignalBinding
{
detach(): boolean;
}
}

class MiniSignal<CbType>
{
constructor();
handlers(exists: true): boolean;
handlers(exists?: false): MiniSignal.MiniSignalBinding[];
has(node: MiniSignal.MiniSignalBinding): boolean;
add(fn: CbType, thisArg?: any): MiniSignal.MiniSignalBinding;
once(fn: CbType, thisArg?: any): MiniSignal.MiniSignalBinding;
detach(node: MiniSignal.MiniSignalBinding): MiniSignal<CbType>;
detachAll(): MiniSignal<CbType>;

dispatch: CbType;
}

export = MiniSignal;
}
20 changes: 11 additions & 9 deletions typings/resource-loader.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Signal from 'mini-signals';

declare namespace async {
function eachSeries(array: any[], iterator: (...params: any[]) => any, callback: (...params: any[]) => any, deferNext?: boolean): void;
function queue(worker: (...params: any[]) => any, concurrency: number): any;
Expand All @@ -18,11 +20,11 @@ declare class Loader {
resources: {
[key: string]: Resource;
};
onProgress: Signal;
onError: Signal;
onLoad: Signal;
onStart: Signal;
onComplete: Signal;
onProgress: Signal<Loader.OnProgressSignal>;
onError: Signal<Loader.OnErrorSignal>;
onLoad: Signal<Loader.OnLoadSignal>;
onStart: Signal<Loader.OnStartSignal>;
onComplete: Signal<Loader.OnCompleteSignal>;
add(name: string, url: string, callback?: Resource.OnCompleteSignal): this;
add(name: string, url: string, options?: IAddOptions, callback?: Resource.OnCompleteSignal): this;
add(url: string, callback?: Resource.OnCompleteSignal): this;
Expand Down Expand Up @@ -83,10 +85,10 @@ declare class Resource {
readonly children: Resource[];
readonly type: Resource.TYPE;
readonly progressChunk: number;
onStart: Signal;
onProgress: Signal;
onComplete: Signal;
onAfterMiddleware: Signal;
onStart: Signal<Resource.OnStartSignal>;
onProgress: Signal<Resource.OnProgressSignal>;
onComplete: Signal<Resource.OnCompleteSignal>;
onAfterMiddleware: Signal<Resource.OnCompleteSignal>;
readonly isDataUrl: boolean;
readonly isComplete: boolean;
readonly isLoading: boolean;
Expand Down

0 comments on commit e9c3c08

Please sign in to comment.