@xmess/angular
v0.1.8
Published
> TODO: description
Downloads
1
Readme
@xmess/core
Table of contents
Description
[should be added here]
Installation
- Installing project dependencies
$ npm i @xmess/core @xmess/angular --save
- 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);
});
}
}