Options
All
  • Public
  • Public/Protected
  • All
Menu

CommBroker is a React type Mediator injectable service provider

Examples

self.onEvent('click').subscribe((e:IMessage)=> { console.log('I heard a click'); });

// won't work, event != jump self.onEvent('jump').subscribe((e:IMessage)=> { console.log('I heard a click'); });

// wont work, this != self self.onInstance(null).subscribe((e:IMessage)=> { console.log('XYZ#$%^& should never come here...'); });

self.onInstanceAndEvent(this, 'click').subscribe((e:IMessage)=> { console.log(I heard you commBroker on event click + e.message); });

self.onInstanceAndEvent(self, 'click').first().subscribe((e:IMessage)=> { var commBroker:CommBroker = e.fromInstance; console.log(just one ${e.event} from ${commBroker.toString()}); });

self.onInstanceAndEvent(self, 'click').subscribe((e:IMessage) => { console.log(handle success: rx ${e.event}) }, (e) => { console.log(handle error ${e}) }, () => { console.log(handle complete) });

// before stream ready var msg1:IMessage = { fromInstance: self, event: 'click', context: 1, message: 'before stream is ready' }; self.fire(msg1);

// after stream ready setTimeout(function () { var msg2:IMessage = { fromInstance: self, event: 'click', context: 2, message: 'after stream is ready' }; self.fire(msg2); }, 2000)

Hierarchy

  • IMessage

Index

Properties

context

context: any

event

event: string

fromInstance

fromInstance: any

message

message: any

Generated using TypeDoc