mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
add rails actioncable definition files
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
/// <reference path="./actioncable.d.ts" />
|
||||
App = {};
|
||||
App.cable = ActionCable.createConsumer();
|
||||
App.cable.subscriptions.create("NetworkChannel", {});
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// 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: {}): Channel;
|
||||
}
|
||||
interface Cable {
|
||||
subscriptions: Subscriptions;
|
||||
}
|
||||
function createConsumer(): Cable;
|
||||
function createConsumer(url: string): Cable;
|
||||
}
|
||||
|
||||
declare interface AppInterface {
|
||||
cable?: ActionCable.Cable;
|
||||
network?: ActionCable.Channel;
|
||||
}
|
||||
|
||||
declare var App: AppInterface;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user