Comparing version 0.0.1 to 0.0.3
19
index.js
@@ -338,6 +338,7 @@ 'use strict'; | ||
* | ||
* @param {Temper} temper Custom Temper instance. | ||
* @param {BigPipe} pipe The BigPipe instance. | ||
* @api private | ||
*/ | ||
Pagelet.optimize = function optimize(pipe) { | ||
Pagelet.optimize = function optimize(temper, pipe) { | ||
var Pagelet = this | ||
@@ -355,3 +356,3 @@ , prototype = Pagelet.prototype | ||
Pagelet.prototype.view = path.resolve(dir, prototype.view); | ||
pipe.temper.prefetch(Pagelet.prototype.view, Pagelet.prototype.engine); | ||
temper.prefetch(Pagelet.prototype.view, Pagelet.prototype.engine); | ||
} | ||
@@ -363,8 +364,10 @@ | ||
// | ||
Pagelet.prototype.error = prototype.error | ||
? path.resolve(dir, prototype.error) | ||
: path.resolve(__dirname, 'error.ejs'); | ||
if (prototype.error) { | ||
Pagelet.prototype.error = path.resolve(dir, prototype.error); | ||
temper.prefetch(Pagelet.prototype.error, Pagelet.prototype.engine); | ||
} else { | ||
Pagelet.prototype.error = path.resolve(__dirname, 'error.ejs'); | ||
temper.prefetch(Pagelet.prototype.error, ''); | ||
} | ||
pipe.temper.prefetch(Pagelet.prototype.error, Pagelet.prototype.engine); | ||
if (prototype.css) Pagelet.prototype.css = path.resolve(dir, prototype.css); | ||
@@ -403,3 +406,3 @@ if (prototype.js) Pagelet.prototype.js = path.resolve(dir, prototype.js); | ||
// | ||
pipe.emit('transform::pagelet', Pagelet); | ||
if (pipe) pipe.emit('transform::pagelet', Pagelet); | ||
Pagelet.properties = Object.keys(Pagelet.prototype); | ||
@@ -406,0 +409,0 @@ |
{ | ||
"name": "pagelet", | ||
"version": "0.0.1", | ||
"version": "0.0.3", | ||
"description": "pagelet", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -146,3 +146,3 @@ # Pagelet | ||
The view a reference to the template that we render inside the | ||
The view is a reference to the template that we render inside the | ||
`data-pagelet="<name>"` placeholders. Please make sure that your template can be | ||
@@ -152,2 +152,16 @@ rendered on both the client and server side. Take a look at our [temper] project | ||
### Pagelet: error | ||
Just like the `Pagelet.view` this is a reference to a template that we will | ||
render in your `data-pagelet="<name>"` placeholders but this template is only | ||
rendered when: | ||
1. We receive an `Error` argument in our callback that we supply to the | ||
`Pagelet#render` method. | ||
2. Your `Pagelet.view` throws an errow when we're rendering the template. | ||
If this property is not set we will default to a template that ships with this | ||
Pagelet by default. This template includes a small HTML fragment that states the | ||
error. | ||
### Pagelet: engine | ||
@@ -154,0 +168,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
20166
408
229
1