1.0.3 • Published 8 years ago

cycle-vex-driver v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

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
1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago