forked from staltz/rxmarbles
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor custom element example to conform to the newest versions of rxmarbles components. Add ES5 custom web component shim, since source code for rxmarbles clasess is compiled to ES5. Update webpack config to compile new custom element source file into distribution folder. Related to staltz#48.
- Loading branch information
1 parent
a31e372
commit 4979838
Showing
5 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import run from '@cycle/rxjs-run'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import { makeDOMDriver, h } from '@cycle/dom'; | ||
import { Sandbox } from './components/sandbox/sandbox'; | ||
import { merge } from 'ramda'; | ||
|
||
class SandboxElement extends HTMLElement { | ||
connectedCallback() { | ||
let key = this.attributes.key.value; | ||
function main( sources ) { | ||
const sandbox = Sandbox( sources ); | ||
const sinks = { | ||
DOM: sandbox.DOM, | ||
store: Observable.merge( sandbox.data ).scan(merge, { route: key, inputs: undefined }), | ||
}; | ||
return sinks; | ||
} | ||
|
||
run(main, { | ||
DOM: makeDOMDriver(this), | ||
store: sources => sources, | ||
}); | ||
} | ||
} | ||
|
||
customElements.define( 'rx-marbles', SandboxElement ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters