mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Minor cleanup for #66
This commit is contained in:
parent
9fa2e6b7ba
commit
6e95e97d49
@ -22,24 +22,24 @@ function notEmpty(o) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLazyRenderer(handler) {
|
function createDeferredRenderer(handler) {
|
||||||
var lazyRenderer = function(input, out) {
|
function deferredRenderer(input, out) {
|
||||||
lazyRenderer.renderer(input, out);
|
deferredRenderer.renderer(input, out);
|
||||||
};
|
}
|
||||||
|
|
||||||
// This is the initial function that will do the rendering. We replace
|
// This is the initial function that will do the rendering. We replace
|
||||||
// the renderer with the actual renderer func on the first render
|
// the renderer with the actual renderer func on the first render
|
||||||
lazyRenderer.renderer = function(input, out) {
|
deferredRenderer.renderer = function(input, out) {
|
||||||
var rendererFunc = handler.renderer || handler.render;
|
var rendererFunc = handler.renderer || handler.render;
|
||||||
if (typeof renderFunc !== 'function') {
|
if (typeof renderFunc !== 'function') {
|
||||||
throw new Error('Invalid tag handler: ' + handler);
|
throw new Error('Invalid tag handler: ' + handler);
|
||||||
}
|
}
|
||||||
// Use the actual renderer from now on
|
// Use the actual renderer from now on
|
||||||
lazyRenderer.renderer = rendererFunc;
|
deferredRenderer.renderer = rendererFunc;
|
||||||
rendererFunc(input, out);
|
rendererFunc(input, out);
|
||||||
};
|
};
|
||||||
|
|
||||||
return lazyRenderer;
|
return deferredRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
var WARNED_INVOKE_BODY = 0;
|
var WARNED_INVOKE_BODY = 0;
|
||||||
@ -141,7 +141,7 @@ module.exports = {
|
|||||||
// to the actual renderer(input, out) function right now we lazily
|
// to the actual renderer(input, out) function right now we lazily
|
||||||
// try to get access to it later.
|
// try to get access to it later.
|
||||||
if (typeof renderFunc !== 'function') {
|
if (typeof renderFunc !== 'function') {
|
||||||
return createLazyRenderer(handler);
|
return createDeferredRenderer(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderFunc;
|
return renderFunc;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user