Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update isomorphic example to use @cycle/html #812

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/advanced/isomorphic/.babelrc
@@ -1,3 +1,3 @@
{
"presets": ["es2015"]
"presets": ["env"]
}
9 changes: 4 additions & 5 deletions examples/advanced/isomorphic/app.js
Expand Up @@ -32,9 +32,9 @@ function renderAboutPage() {
}

export default function app(sources) {
const click$ = sources.DOM.select('.link').events('click');

const preventedEvent$ = click$;
const click$ = sources.DOM.select('.link').events('click', {
preventDefault: true
});

const contextFromClick$ = click$
.map(ev => ({route: ev.currentTarget.attributes.href.value}));
Expand All @@ -54,7 +54,6 @@ export default function app(sources) {
});

return {
DOM: vdom$,
PreventDefault: preventedEvent$
DOM: vdom$
};
}
7 changes: 0 additions & 7 deletions examples/advanced/isomorphic/client.js
Expand Up @@ -9,14 +9,7 @@ function clientSideApp(sources) {
return sinks;
}

function preventDefaultDriver(ev$) {
ev$.addListener({
next: ev => ev.preventDefault(),
});
}

run(clientSideApp, {
DOM: makeDOMDriver('.app-container'),
context: () => xs.of(window.appContext),
PreventDefault: preventDefaultDriver,
});
15 changes: 8 additions & 7 deletions examples/advanced/isomorphic/package.json
Expand Up @@ -5,17 +5,18 @@
"author": "Andre Staltz",
"license": "MIT",
"dependencies": {
"@cycle/dom": "15.0.0-rc.3",
"@cycle/run": "1.0.0-rc.9",
"xstream": "10.2",
"@cycle/dom": "20.4.0",
"@cycle/html": "2.4.0",
"@cycle/run": "4.1.0",
"xstream": "11.2",
"babel-cli": "^6.7.5",
"babel-preset-es2015": "^6.3.13",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.4.3",
"babelify": "^7.2.0",
"browserify": "13.0.x",
"babelify": "^8.0.0",
"browserify": "16.2.x",
"express": "^4.12.3",
"serialize-javascript": "^1.0.0",
"uglifyify": "^3.0.1"
"uglifyify": "^5.0.0"
},
"scripts": {
"start": "npm install && babel-node ./server.js"
Expand Down
4 changes: 2 additions & 2 deletions examples/advanced/isomorphic/server.js
Expand Up @@ -3,7 +3,8 @@ import xs from 'xstream';
import express from 'express';
import browserify from 'browserify';
import serialize from 'serialize-javascript';
import {html, head, title, body, div, script, makeHTMLDriver} from '@cycle/dom';
import {html, head, title, body, div, script} from '@cycle/dom';
import {makeHTMLDriver} from '@cycle/html';
import app from './app';

function wrapVTreeWithHTMLBoilerplate([vtree, context, clientBundle]) {
Expand Down Expand Up @@ -72,7 +73,6 @@ server.use(function (req, res) {
run(wrappedAppFn, {
DOM: makeHTMLDriver(html => res.send(prependHTML5Doctype(html))),
context: () => context$,
PreventDefault: () => {},
});
});

Expand Down