Skip to content

Loading…

add job finished plugin call back #18

Merged
merged 2 commits into from

3 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +4 −1 lib/renderer.js
  3. +1 −1 lib/server.js
View
1 .gitignore
@@ -1,3 +1,4 @@
*.iml
node_modules/
.DS_Store
+.idea/
View
5 lib/renderer.js
@@ -166,8 +166,9 @@ PrerenderRenderer.prototype.afterRender = function(page) {
/*
* Job finished and the response has been sent
*/
-PrerenderRenderer.prototype.jobFinished = function() {
+PrerenderRenderer.prototype.jobFinished = function(job) {
this.job = null;
+ this.pluginEvent('jobFinished', [job]);
};
/*
@@ -213,6 +214,8 @@ PrerenderRenderer.prototype.pluginEvent = function(methodName, args, callback) {
var _this = this;
var index = 0;
+ callback = callback || function() {};
+
var next = function() {
var layer = _this.plugins[index++];
if (!layer) {
View
2 lib/server.js
@@ -108,7 +108,7 @@ PrerenderServer.prototype.sendPage = function(job) {
job.res.writeHead(job.page.statusCode, {'Content-Type': 'text/html;charset=UTF-8'});
job.res.end(job.page.html);
- this.renderer.jobFinished();
+ this.renderer.jobFinished(job);
this.processQueue();
};
Something went wrong with that request. Please try again.