Neurotoxin Powered Marketing

    @wuchuheng/rxjs
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.5 • Public • Published

    Reactive extension for javascript.

    Description

    This is a library for communication between components, similar to redux, but it is simpler and easier to use.

    Installing

    $ npm i @wuchuheng/rxjs

    Usage

    step1 declare Scheduler for communication between components

    import SubscriptionService from "@wuchuheng/rxjs";
    
    // This is a scheduler where all the subscribers will be stored
    class Scheduler {
        public static chatGroupObserve = new SubscriptionService<string>('');
    }

    step2 usage directly in components

    import {useObserve} from "@wuchuheng/rxjs";
    
    const componentA = () => {
        const [message, dispatcher] = useObserve(Scheduler.chatGroupObserve); 
        // a new message will be dispatch here. 
        return <input onchange={e => dispatcher.next(e.target.value)} />
    }
    
    const componentB = () => {
        // This hook will subscribe to the new message.
        const [message] = useObserve(Scheduler.chatGroupObserve);
        return <>{message}</>
    }

    You can contribute in one of three ways:

    1. File bug reports using the issue tracker.
    2. Answer questions or fix bugs on the issue tracker.
    3. Contribute new features or update the wiki.

    The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.

    License

    MIT

    Keywords

    none

    Install

    npm i @wuchuheng/rxjs

    DownloadsWeekly Downloads

    7

    Version

    1.0.5

    License

    ISC

    Unpacked Size

    6.2 kB

    Total Files

    4

    Last publish

    Collaborators

    • wuchuheng