Skip to content

Commit

Permalink
Add "updates" hook
Browse files Browse the repository at this point in the history
  • Loading branch information
creynders committed Mar 23, 2015
1 parent 30336e1 commit 87fb56e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var moduleRoot = (function(_rootPath) {

var Keystone = function() {
grappling.mixin(this)
.allowHooks('pre:routes', 'pre:render');
.allowHooks('pre:routes', 'pre:render', 'updates');
this.lists = {};
this.paths = {};
this._options = {
Expand Down Expand Up @@ -209,7 +209,15 @@ Keystone.prototype.import = function(dirname) {
*/

Keystone.prototype.applyUpdates = function(callback) {
require('./lib/updates').apply(callback);
var self = this;
self.callHook('pre:updates', function(err){
require('./lib/updates').apply(function(err){
if(err){
callback(err);
}
self.callHook('post:updates', callback);
});
})
};


Expand Down

0 comments on commit 87fb56e

Please sign in to comment.