0.1.8 • Published 5 years ago

@xmess/angular v0.1.8

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

@xmess/core

Table of contents

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

Description


should be added here

Installation


  1. Installing project dependencies
$ npm i @xmess/core @xmess/angular --save
  1. Import Xmess, and provide base configuration
import { XmessModule } from ng;

@NgModule({
  imports: [
    XmessModule.forRoot('some-id'),
  ],
})

Usage


import { XmessService } from '@xmess/angular';
import { IChannelMessage } from '@xmess/core/dist/types';

@Component({
  // ...
})
export class SomeComponent() {
  private sentMessageList: Array<IChannelMessage> = [];

  constructor(private xmessService: XmessService) {
    this.subscribeToAllMessages();
  }

  public sendMessage(channelPath, payload) {
    this.xmessService.channel(channelPath).publish(payload);
  }

  private subscribeToAllMessages() {
    this.xmessService.channel('#').subscribe((message) => {
      this.receivedMessageList.push(message);
    });
  }
}

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