0.1.8 • Published 5 years ago

@xmess/binder v0.1.8

Weekly downloads
2
License
MIT
Repository
-
Last release
5 years ago

@xmess/binder

Table of contents

  1. Description
  2. Installation
  3. Usage
  4. API

Description


Installation


  1. Installing project dependencies
$ npm i @xmess/binder --save
  1. Import BinderPlugin and add to plugins
import { Xmess } from '@xmess/core';
import { BinderPlugin } from '@xmess/binder';

const xmess = new Xmess('some-id', {
  plugins: [
    new BinderPlugin(),
  ],
});

Usage


Without BinderPlugin

const xmess1 = new Xmess('xmess-1');
const xmess2 = new Xmess('xmess-2');

xmess1.channel('some-channel').subscribe((message) => {
  // xmess1 isn't receiving messages from global context
});

xmess2.channel('some-channel').publish('some-message');
// xmess2 is sharing messages to global context

With BinderPlugin

import { BinderPlugin } from '@xmess/binder';

const xmess1 = new Xmess('xmess-1', {
  plugins: [
    new BinderPlugin(),
  ],
});

const xmess2 = new Xmess('xmess-2', {
  plugins: [
    new BinderPlugin(),
  ],
});

xmess1.channel('some-channel').subscribe((message) => {
  // xmess1 is receiving messages from global context
});

xmess2.channel('some-channel').publish('some-message');
// xmess1 is sharing messages to global context

API


0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.3

5 years ago

0.1.4

5 years ago