mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-21 05:20:24 +08:00
23 lines
567 B
TypeScript
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');
|