forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rails-actioncable.d.ts
40 lines (32 loc) · 914 Bytes
/
rails-actioncable.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Type definitions for ActionCable
// Project: https://github.com/rails/rails/tree/master/actioncable
// Definitions by: Vincent Zhu <https://github.com/zhu1230>
// Definitions: https://github.com/zhu1230/DefinitelyTyped
declare module ActionCable {
interface Channel {
unsubscribe(): void;
perform(action: string, data: {}): void;
}
interface Subscriptions {
create(chan_name: string, obj: CreateMixin): Channel;
}
interface Cable {
subscriptions: Subscriptions;
}
interface CreateMixin {
connected(): void;
disconnected(): void;
received(obj: Object): void;
[key: string]: Function;
}
function createConsumer(): Cable;
function createConsumer(url: string): Cable;
}
declare interface AppInterface {
cable?: ActionCable.Cable;
network?: ActionCable.Channel;
}
declare var App: AppInterface;
declare module 'actioncable' {
export = ActionCable;
}