Last active
August 29, 2015 14:21
-
-
Save HendrikRoth/c43a8ec3264e85c9d8cc to your computer and use it in GitHub Desktop.
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
'use strict' | |
function createView(ctrl, opts, children) { | |
return m('h1', 'Cached') | |
} | |
function controller() { | |
return { | |
view: m.prop() | |
} | |
} | |
function view(ctrl, opts, children) { | |
var view = ctrl.view() | |
if (!view || opts.refresh) { | |
view = createView(ctrl, opts, children) | |
ctrl.view(view) | |
return view | |
} | |
return {subtree: 'retain'} | |
} | |
module.exports = { | |
controller: controller, | |
view: view | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment