Comparing version 0.5.0 to 0.6.0
27
index.js
@@ -180,3 +180,3 @@ 'use strict'; | ||
/** | ||
* A pagelet has been initialised. | ||
* A pagelet has been initialized. | ||
* | ||
@@ -357,3 +357,3 @@ * @type {Function} | ||
function fragment(content) { | ||
if (options.substream) { | ||
if (options.substream || pagelet.page && pagelet.page.mode === 'sync') { | ||
data.view = content; | ||
@@ -375,5 +375,5 @@ return fn.call(context, undefined, data); | ||
fn.call(context, undefined, pagelet.fragment | ||
.replace(/\{pagelet::name\}/g, pagelet.name) | ||
.replace(/\{pagelet::template\}/g, content.replace(/<!--(.|\s)*?-->/, '')) | ||
.replace(/\{pagelet::data\}/g, data) | ||
.replace(/\{pagelet:name\}/g, pagelet.name) | ||
.replace(/\{pagelet:template\}/g, content.replace(/<!--(.|\s)*?-->/, '')) | ||
.replace(/\{pagelet:data\}/g, data) | ||
); | ||
@@ -504,6 +504,6 @@ | ||
pagelet[data.type](data.body || {}, data.files || [], function processed(err, data) { | ||
pagelet[data.type](data.body || {}, data.files || [], function processed(err, context) { | ||
if (err) return stream.write({ type: data.type, err: err }); | ||
pagelet.render({ data: data, substream: true }, function rendered(err, fragment) { | ||
pagelet.render({ data: context, substream: true }, function rendered(err, fragment) { | ||
stream.write({ type: 'fragment', frag: fragment, err: err }); | ||
@@ -668,11 +668,2 @@ }); | ||
// | ||
// Aliasing, some methods can be written with different names or American | ||
// vs Britain vs old English. For example `initialise` vs `initialize` but | ||
// also the use of CAPS like `RPC` vs `rpc` | ||
// | ||
if (Array.isArray(prototype.rpc) && !prototype.RPC.length) { | ||
prototype.RPC = prototype.rpc; | ||
} | ||
if ('string' === typeof prototype.RPC) { | ||
@@ -682,6 +673,2 @@ prototype.RPC= prototype.RPC.split(/[\s|\,]/); | ||
if ('function' === typeof prototype.initialise) { | ||
prototype.initialize = prototype.initialise; | ||
} | ||
// | ||
@@ -688,0 +675,0 @@ // Allow plugins to hook in the transformation process, so emit it when |
{ | ||
"name": "pagelet", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "pagelet", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
34042
643