phoenix-types
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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"));

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    70
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.0
    70

Package Sidebar

Install

npm i phoenix-types

Weekly Downloads

70

Version

0.1.0

License

MIT

Unpacked Size

14.2 kB

Total Files

6

Last publish

Collaborators

  • teaearlgraycold