From 6407188ee9a3297cb25d998a5b3d6adc2f1e9cba Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Sat, 2 Jul 2016 00:13:13 +0200 Subject: [PATCH] router: change order of arguments fixup! freeze state & rename app ns to location --- examples/http/views/main.js | 2 +- examples/mailbox/elements/email-list.js | 3 +- examples/mailbox/elements/email.js | 3 +- examples/mailbox/elements/empty-mailbox.js | 2 +- examples/mailbox/elements/mailbox.js | 3 +- examples/mailbox/elements/nav.js | 2 +- examples/mailbox/elements/pathname.js | 4 +- examples/mailbox/views/email.js | 10 +-- examples/mailbox/views/empty.js | 8 +-- examples/mailbox/views/mailbox.js | 8 +-- examples/server-rendering/views/main.js | 2 +- examples/title/client.js | 2 +- index.js | 74 ++++++++++++++++------ package.json | 2 +- tests/server/index.js | 10 +-- 15 files changed, 85 insertions(+), 50 deletions(-) diff --git a/examples/http/views/main.js b/examples/http/views/main.js index 0811c694..989af233 100644 --- a/examples/http/views/main.js +++ b/examples/http/views/main.js @@ -1,6 +1,6 @@ const html = require('../../../html') -module.exports = function (params, state, send) { +module.exports = function (state, prev, send) { const error = state.app.errors[0] const title = state.api.title return html` diff --git a/examples/mailbox/elements/email-list.js b/examples/mailbox/elements/email-list.js index e964108f..be25b8bc 100644 --- a/examples/mailbox/elements/email-list.js +++ b/examples/mailbox/elements/email-list.js @@ -1,7 +1,8 @@ const dateformat = require('dateformat') const html = require('../../../html') -module.exports = function (params, state, send) { +module.exports = function (state, prev, send) { + const params = state.params const mailbox = params.mailbox const messages = state[mailbox].messages return html` diff --git a/examples/mailbox/elements/email.js b/examples/mailbox/elements/email.js index ec2624b4..3f7efb75 100644 --- a/examples/mailbox/elements/email.js +++ b/examples/mailbox/elements/email.js @@ -1,6 +1,7 @@ const html = require('../../../html') -module.exports = function (params, state, send) { +module.exports = function (state, prev, send) { + const params = state.params const mailbox = params.mailbox const message = params.message diff --git a/examples/mailbox/elements/empty-mailbox.js b/examples/mailbox/elements/empty-mailbox.js index 395685d1..a6d6d31b 100644 --- a/examples/mailbox/elements/empty-mailbox.js +++ b/examples/mailbox/elements/empty-mailbox.js @@ -1,6 +1,6 @@ const html = require('../../../html') -module.exports = function (params, state, send) { +module.exports = function (state, prev, send) { return html`

Select a mailbox

diff --git a/examples/mailbox/elements/mailbox.js b/examples/mailbox/elements/mailbox.js index 8accf8db..434d3bf0 100644 --- a/examples/mailbox/elements/mailbox.js +++ b/examples/mailbox/elements/mailbox.js @@ -2,7 +2,8 @@ const dateformat = require('dateformat') const html = require('../../../html') module.exports = function () { - return function (params, state, send) { + return function (state, prev, send) { + const params = state.params const mailbox = params.mailbox const message = params.message const messages = state[mailbox].messages diff --git a/examples/mailbox/elements/nav.js b/examples/mailbox/elements/nav.js index a85b3d3a..5a056f06 100644 --- a/examples/mailbox/elements/nav.js +++ b/examples/mailbox/elements/nav.js @@ -2,7 +2,7 @@ const html = require('../../../html') const mailboxes = [ 'inbox', 'spam', 'sent' ] -module.exports = function (params, state, send) { +module.exports = function (state, prev, send) { return html`