Skip to content

Commit 97f4a4d

Browse files
sqlProvidersqlProvider
authored andcommitted
[Interfaces] added interfaces to $sub method
1 parent 711a98a commit 97f4a4d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/angular2-pubsub.service.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ export class PubSubService implements IPubSubService {
1111

1212
constructor() { }
1313

14+
public $sub(event: string): Observable<any>;
15+
public $sub(event: string, callback: (value: any) => void): Subscription;
16+
public $sub(event: string, callback: (value: any) => void, error: (error: any) => void): Subscription;
17+
public $sub(event: string, callback: (value: any) => void, error: (error: any) => void, complete: () => void): Subscription;
1418
public $sub(event: string, callback?: (value: any) => void, error?: (error: any) => void, complete?: () => void) {
1519
if (!event) {
1620
throw new Error(`[${ServiceName}] => Subscription method must get event name.`);
@@ -40,5 +44,15 @@ export class PubSubService implements IPubSubService {
4044

4145
export interface IPubSubService {
4246
$pub(event: string, eventObject?: any);
43-
$sub(event: string, callback?: (value: any) => void, error?: (error: any) => void, complete?: () => void);
47+
$sub(event: string): Observable<any>;
48+
$sub(event: string, callback: (value: any) => void): Subscription;
49+
$sub(event: string, callback: (value: any) => void, error: (error: any) => void): Subscription;
50+
$sub(event: string, callback: (value: any) => void, error: (error: any) => void, complete: () => void): Subscription;
4451
}
52+
53+
interface I$sub{
54+
(event: string): Observable<any>;
55+
(event: string, callback: (value: any) => void): Subscription;
56+
(event: string, callback: (value: any) => void, error: (error: any) => void): Subscription;
57+
(event: string, callback: (value: any) => void, error: (error: any) => void, complete: () => void): Subscription;
58+
}

0 commit comments

Comments
 (0)