cycle-vex-driver

    1.0.3 • Public • Published

    cycle-vex-driver

    A Cycle.js Driver for using Dialog by HubSpot/vex

    install

    npm

    npm install cycle-vex-driver
    

    Usage

    import Rx from 'rx';
    import Cycle from '@cycle/core';
    import makeVexDriver from '../';
     
    //main
    function main(sources) {
        let nextDialog$ = sources.Dialog
            .filter(({id}) => id == 'first')
            .map(x => ({
              method: 'alert',
              options: {
                  message: 'result value:' + x.value
              }
            }));
     
        let dialog$ = Rx.Observable.just({
            id: 'first',
            method: 'prompt',
                options: {
                message: 'hello cycle.js',
                placeholder: 'input'
            }
        }).merge(nextDialog$);
        return {
            Dialog: dialog$
        };
    }
     
    //run with drivers
    Cycle.run(main, {
        Dialog: makeVexDriver('vex-theme-default')
    });

    link stylesheets

    <link rel="stylesheet" href="../node_modules/vex-js/css/vex.css" />
    <link rel="stylesheet" href="../node_modules/vex-js/css/vex-theme-default.css" />

    check example

    cd example
    webpack
    # open index.html 

    Install

    npm i cycle-vex-driver

    DownloadsWeekly Downloads

    1

    Version

    1.0.3

    License

    MIT

    Last publish

    Collaborators

    • nakaji-dayo