Skip to content
Myr

`app.dynamicHelpers` -> `app.dynamicLocals`

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent b13ec85 · Browse files · 3 files+11 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+11 added−11 removed

  • tests:+1 added−1 removed
  • other:+10 added−10 removed

3 files+11 added−11 removed

modified:lib/http.js+3 added-3 removed
61 unmodified lines
62 this.settings = {};63 this.redirects = {};64 this.isCallbacks = {};65 this._locals = {};66 this.dynamicViewHelpers = {};66 this._dynamicLocals = {};6768 this.set('home', '/');69 this.set('env', process.env.NODE_ENV || 'development');70
205 unmodified lines
276 * @return {Server} for chaining277 * @api public278 */279280app.dynamicHelpers = function(obj){281 utils.merge(this.dynamicViewHelpers, obj);280app.dynamicLocals = function(obj){281 utils.merge(this._dynamicLocals, obj);282 return this;283};284285/**
216 unmodified lines
modified:lib/view.js+7 added-7 removed
333 unmodified lines
334 var options = {}335 , self = this336 , app = this.app337 , helpers = app._locals338 , dynamicHelpers = app.dynamicViewHelpers338 , dynamic = app._dynamicLocals339 , viewOptions = app.set('view options')340 , root = app.set('views') || process.cwd() + '/views';341342 // cache id
42 unmodified lines
385 // charset option386 if (options.charset) this.charset = options.charset;387388 // Dynamic helper support389 if (false !== options.dynamicHelpers) {389 if (false !== options.dynamic) {390 // cache391 if (!this.__dynamicHelpers) {392 this.__dynamicHelpers = {};393 for (var key in dynamicHelpers) {394 this.__dynamicHelpers[key] = dynamicHelpers[key].call(391 if (!this.__dynamic) {392 this.__dynamic = {};393 for (var key in dynamic) {394 this.__dynamic[key] = dynamic[key].call(395 this.app396 , this.req397 , this);398 }399 }400401 // apply402 merge(options, this.__dynamicHelpers);402 merge(options, this.__dynamic);403 }404405 // Merge view helpers406 union(options, helpers);
53 unmodified lines
modified:test/view.test.js+1 added-1 removed
326 unmodified lines
327 return 'Hello ' + sess.name + ' ' + lastName; 328 }329 });330 331 var ret = app.dynamicHelpers({331 var ret = app.dynamicLocals({332 session: function(req, res){333 ++calls;334 req.should.be.a('object');335 res.should.be.a('object');
817 unmodified lines