0.1.9 • Published 10 years ago

ls-events-client v0.1.9

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

Longshot: events-client

Client-side events subscription using Socket.io

Installation

npm install ls-events-client --save
or jspm install npm:ls-events-client

Usage

The events-client API is fluent. See below:

// ES6
import events = require("ls-events-client");

//
events
	.setHost("localhost", 10001);
	.start()
	.sub("users", "create", "*", msg => {
		// Subscribe to all user created events
	})
	.sub("users", "update", "carl", msg => {
		// Subscribe to all updates to the user 'carl'
	});

API

setHost

Set the host end-point details

function setHost(host: string, port: number): Client;
start

Connect to the end point

function start(): Client;
subscribe

N.B.: context, event, and key can be null or "*". These both refer to 'all'.

  • Context: The type of object. E.g. users, invoices, orders, items, etc.
  • Event: The type of event raised. E.g. create, read, update, delete, notify, etc.
  • Key: The key of the object.
function sub(context?: string, event?: string, key?: string): Client;
0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.0

10 years ago