Skip to content

Commit 0fcb448

Browse files
author
Vlad Balin
committed
Fixed Messenger type signatures
1 parent 5eeb592 commit 0fcb448

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

Diff for: dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/object-plus/events.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export declare class Messenger implements Mixable, EventSource {
3131
_localEvents: EventMap;
3232
constructor();
3333
initialize(): void;
34-
on(events: string | EventCallbacks<this>, callback: any, context?: any): this;
35-
once(events: string | EventCallbacks<this>, callback: any, context?: any): this;
34+
on(events: string | EventCallbacks<this>, callback?: any, context?: any): this;
35+
once(events: string | EventCallbacks<this>, callback?: any, context?: any): this;
3636
off(events?: string | EventCallbacks<this>, callback?: any, context?: any): this;
3737
trigger(name: string, a?: any, b?: any, c?: any, d?: any, e?: any): this;
3838
listenTo(source: Messenger, a: string | EventCallbacks<this>, b?: Function): this;

Diff for: lib/object-plus/events.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/transactions.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export declare abstract class Transactional implements Messenger, IONode, Valida
1919
static onDefine(definitions: TransactionalDefinition, BaseClass: typeof Transactional): void;
2020
static onExtend(BaseClass: typeof Transactional): void;
2121
static create(a: any, b?: any): Transactional;
22-
on: (events: string | EventCallbacks<this>, callback: any, context?: any) => this;
23-
once: (events: string | EventCallbacks<this>, callback: any, context?: any) => this;
22+
on: (events: string | EventCallbacks<this>, callback?: any, context?: any) => this;
23+
once: (events: string | EventCallbacks<this>, callback?: any, context?: any) => this;
2424
off: (events?: string | EventCallbacks<this>, callback?: any, context?: any) => this;
2525
trigger: (name: string, a?: any, b?: any, c?: any, d?: any, e?: any) => this;
2626
stopListening: (source?: Messenger, a?: string | EventCallbacks<this>, b?: Function) => this;

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "type-r",
3-
"version": "3.0.4",
3+
"version": "3.0.5",
44
"description": "Serializable, validated, and observable data layer for modern JS applications",
55
"main": "./dist/index.js",
66
"jsnext:main": "./lib/index.js",

Diff for: src/object-plus/events.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ export class Messenger implements Mixable, EventSource {
9494
/** Method is called at the end of the constructor */
9595
initialize() : void {}
9696

97-
on( events : string | EventCallbacks<this>, callback, context? ) : this {
97+
on( events : string | EventCallbacks<this>, callback?, context? ) : this {
9898
if( typeof events === 'string' ) strings( on, this, events, callback, context );
9999
else for( let name in events ) strings( on, this, name, events[ name ], context || callback );
100100

101101
return this;
102102
}
103103

104-
once( events : string | EventCallbacks<this>, callback, context? ) : this {
104+
once( events : string | EventCallbacks<this>, callback?, context? ) : this {
105105
if( typeof events === 'string' ) strings( once, this, events, callback, context );
106106
else for( let name in events ) strings( once, this, name, events[ name ], context || callback );
107107

Diff for: src/transactions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export abstract class Transactional implements Messenger, IONode, Validatable, T
5454
}
5555

5656
/** Generic class factory. May be overridden for abstract classes. Not inherited. */
57-
on : ( events : string | EventCallbacks<this>, callback, context? ) => this
58-
once : ( events : string | EventCallbacks<this>, callback, context? ) => this
57+
on : ( events : string | EventCallbacks<this>, callback?, context? ) => this
58+
once : ( events : string | EventCallbacks<this>, callback?, context? ) => this
5959
off : ( events? : string | EventCallbacks<this>, callback?, context? ) => this
6060
trigger : (name : string, a?, b?, c?, d?, e? ) => this
6161

0 commit comments

Comments
 (0)