All Projects → drawcall → Rxemitter

drawcall / Rxemitter

RxEmitter = 🐟Rxjs + 🐡eventBus.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Rxemitter

rjax
base on rxjs awesome ajax library
Stars: ✭ 63 (+46.51%)
Mutual labels:  rxjs, observable
rx-ipc-electron
Pass RxJS Observables through IPC in Electron
Stars: ✭ 28 (-34.88%)
Mutual labels:  rxjs, observable
react-with-observable
Use Observables with React declaratively!
Stars: ✭ 108 (+151.16%)
Mutual labels:  rxjs, observable
monogram
Aspect-oriented layer on top of the MongoDB Node.js driver
Stars: ✭ 76 (+76.74%)
Mutual labels:  rxjs, observable
Recycle
Convert functional/reactive object description using RxJS into React component
Stars: ✭ 374 (+769.77%)
Mutual labels:  rxjs, observable
observe-component
A library for accessing React component events as reactive observables
Stars: ✭ 36 (-16.28%)
Mutual labels:  rxjs, observable
rx-ease
Spring animation operator for rxjs 🦚✨
Stars: ✭ 16 (-62.79%)
Mutual labels:  rxjs, observable
rxrest
Reactive rest library
Stars: ✭ 33 (-23.26%)
Mutual labels:  rxjs, observable
Formily
Alibaba Group Unified Form Solution -- Support React/ReactNative/Vue2/Vue3
Stars: ✭ 6,554 (+15141.86%)
Mutual labels:  rxjs, observable
axios-for-observable
A RxJS wrapper for axios, same api as axios absolutely
Stars: ✭ 13 (-69.77%)
Mutual labels:  rxjs, observable
rxjs-proxify
Turns a Stream of Objects into an Object of Streams
Stars: ✭ 34 (-20.93%)
Mutual labels:  rxjs, observable
Evolui
A tiny reactive user interface library, built on top of RxJs.
Stars: ✭ 43 (+0%)
Mutual labels:  rxjs, observable
rxact
Rxact is an observable application management for Javascript app
Stars: ✭ 21 (-51.16%)
Mutual labels:  rxjs, observable
BittrexRx
BittrexRx is a rxjs node wrapper for the Bittrex Api
Stars: ✭ 16 (-62.79%)
Mutual labels:  rxjs, observable
mst-effect
💫 Designed to be used with MobX-State-Tree to create asynchronous actions using RxJS.
Stars: ✭ 19 (-55.81%)
Mutual labels:  rxjs, observable
polyrhythm
A 3Kb full-stack async effect management toolkit over RxJS. Uses a Pub-Sub paradigm to orchestrate Observables in Node, or the browser (ala Redux Saga). Exports: channel, listen, filter, trigger, after.
Stars: ✭ 23 (-46.51%)
Mutual labels:  rxjs, observable
observable-profiler
Tracks new & disposed Observable subscriptions
Stars: ✭ 41 (-4.65%)
Mutual labels:  rxjs, observable
ng-observe
Angular reactivity streamlined...
Stars: ✭ 65 (+51.16%)
Mutual labels:  rxjs, observable
observable-playground
Know your Observables before deploying to production
Stars: ✭ 96 (+123.26%)
Mutual labels:  rxjs, observable
Ngx Restangular
Restangular for Angular 2 and higher versions
Stars: ✭ 787 (+1730.23%)
Mutual labels:  rxjs, observable

logo

RxEmitter

RxEmitter = Rxjs + eventBus.

RxEmitter combines the characteristics of Rxjs and eventBus.Emit a Stream of similar events, and you can accept it in any where.
Use RxEmitter to make your project easy to decouple. It can be used for angular,React,Vue and so on.

Installation and Usage

ES6 or TypeScript

Installation
npm install rxemitter
emit
import { RxEmitter, toRxEmitter, rxEmit } from 'rxemitter';
...

/** emit */
Observable.from([1,2,3,4])
          .map(x => x*10)
          .toRxEmitter('ADD_AN_NUMBER')

or
 
Observable.of('hello world')
          .rxEmit('ADD_NEW_WORD')
          .subscribe(x=>x);
          
or 

RxEmitter.emit("EVENT_NAME",{a:1,b:2});
on
import { RxEmitter } from 'rxemitter';
...

/** on */
RxEmitter.on('ADD_AN_NUMBER').subscribe(x=> console.log(`ADD A NEW NUMBER - ${x}`));

or

@RxOn("ADD_AN_NUMBER")
value:Observable<number>;

or 

@RxSubscribe("ADD_AN_NUMBER")
subscribe(value:number){
    console.log(value);
}
Rxemitter can be used for Angular2+、React、Vue and so on.

API Methods

RxEmitter.emit<T>(eventName: string, ...rest: T[]): string

emit a global event , passing a stream

RxEmitter.emit("HELLO_WORLD", myObj);

toRxEmitter<T>(this: Observable<T>, a: any, b?: any): Subscription

RxEmitter.emit an Observable sequence.

Observable
.fromEvent(document, 'click')
.interval(1000)
.toRxEmitter({ eventName: 'MOUSE_CLICK', timeout: 10 })

or

Observable
.from([1,2,3,4])
.toRxEmitter({ eventName: 'VALUE', map: x=>x+10 })

or

Observable
.from([1,2,3,4])
.toRxEmitter('CHANGE_EVENT')

rxEmit<T>(this: Observable<T>, a: any, b?: any): Observable<T>

rxEmit an Observable sequence.

Observable
.fromEvent(document, 'click')
.rxEmit({ eventName: 'MOUSE_CLICK', log:true })
.subscribe(x=>x)

RxOn(a: string | Object, b: boolean | string = false, c: any = null)

To attaches an event handlers, we can use the @RxOn decorator.

@RxOn("HELLO_WORLD")
value:Observable<number>;

RxSubscribe(a: string | Object, b: boolean | string = false, c: any = null)

To attaches an event handlers and registration a listener handler, we can use the @RxSubscribe decorator.

@RxSubscribe("HELLO_WORLD")
subscribe(value:number){
	console.log(value);
}

RxEmitter.on<T>(eventName: string, target?: any): Observable

attaches an event handlers

RxEmitter.on("HELLO_WORLD")
		.map(x=>x+1)
		.subscribe(x=>console.log(x));

RxEmitter.off(eventName: string): any

remove all event handlers

RxEmitter.off("HELLO_WORLD");

unsubscribe(target: any, eventName?: string)

disposal the resources , target is your registration id

RxEmitter.unsubscribe(this,"HELLO_WORLD");

offAllByTarget(target: any)

remove id=target event handlers and disposal the resources.

RxEmitter.offAllByTarget(this);

Used in the angular

import { RxOn } from 'rxemitter';
//
@RxOn("DATA_LOADED")
items$: Observable<Item[]>;

//in html
<li *ngFor="let item of items $ | async"

logo

Used in the vue-rx

vue-rx library

//a component
Vue.component('a', {
  subscriptions: function () {
    return {
      value$: this.$fromDOMEvent('input', 'keyup')
      .pluck('target', 'value')
      .rxEmit('INPUT_KEYUP')
    }
  }
})

//b component
Vue.component('b', {
  subscriptions: function () {
    return {
      value$: RxEmitter.on('INPUT_KEYUP')
    }
  }
})

//html
<div>{{ value$ }}</div>

Building

//build es6
npm run es6

//build commonjs
npm run cjs

//clone package
npm run package

//run all
npm run all
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].