phoenix-types
v0.1.0
Published
Templated type definitions for phoenix.js bundled in Phoneix Framework.
Downloads
983
Readme
phoenix-types
Types for the Phoenix Framework JS Library version 1.3.0.
Installation
npm install -S phoenix-types
Usage
import { Socket, Channel } from "phoenix";
interface SocketAuth {
auth_token: string
}
interface ChannelTx {
message: string
}
interface ChannelRx {
message: string,
user: string
}
const params = {auth_token: "..."};
let socket = new Socket<SocketAuth>("/my_endpoint", {params});
socket.connect();
let channel = socket.channel<ChannelTx, ChannelRx>("room:lobby");
channel.join()
.receive("ok", () => console.log("connected"))
.receive("error", () => console.error("could not connect"));