Files
DefinitelyTyped/actioncable/actioncable-tests.ts
2016-11-18 08:05:35 -08:00

23 lines
567 B
TypeScript

interface HelloChannel extends ActionCable.Channel {
hello(world: string, name?: string): void;
}
App = {};
App.cable = ActionCable.createConsumer();
const helloChannel = App.cable.subscriptions.create('NetworkChannel', {
connected(): void {
console.log('connected');
},
disconnected(): void {
console.log('disconnected');
},
received(obj: Object): void {
console.log(obj);
},
hello(world: string, name: string = 'John Doe'): void {
console.log(`Hello, ${world}! name[${name}]`);
}
}) as HelloChannel;
helloChannel.hello('World');