repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var behaviorEvents = _.result(this, 'events'); var viewEvents = this.view.events; if (!viewEvents) { if (!behaviorEvents) { return; } else { viewEvents = {}; } } var namespacedEvents = this.__namespaceEvents(behaviorEvents); ...
javascript
function() { var behaviorEvents = _.result(this, 'events'); var viewEvents = this.view.events; if (!viewEvents) { if (!behaviorEvents) { return; } else { viewEvents = {}; } } var namespacedEvents = this.__namespaceEvents(behaviorEvents); ...
[ "function", "(", ")", "{", "var", "behaviorEvents", "=", "_", ".", "result", "(", "this", ",", "'events'", ")", ";", "var", "viewEvents", "=", "this", ".", "view", ".", "events", ";", "if", "(", "!", "viewEvents", ")", "{", "if", "(", "!", "behavio...
Adds behavior's event handlers to view Behavior's event handlers fire on view events but are run in the context of the behavior @method __bindEventCallbacks @private
[ "Adds", "behavior", "s", "event", "handlers", "to", "view", "Behavior", "s", "event", "handlers", "fire", "on", "view", "events", "but", "are", "run", "in", "the", "context", "of", "the", "behavior" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L1933-L1955
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(eventHash) { // coped from Backbone var delegateEventSplitter = /^(\S+)\s*(.*)$/; var namespacedEvents = {}; var behaviorId = this.cid; _.each(eventHash, function(value, key) { var splitEventKey = key.match(delegateEventSplitter); var eventName = splitEventKey[1]; ...
javascript
function(eventHash) { // coped from Backbone var delegateEventSplitter = /^(\S+)\s*(.*)$/; var namespacedEvents = {}; var behaviorId = this.cid; _.each(eventHash, function(value, key) { var splitEventKey = key.match(delegateEventSplitter); var eventName = splitEventKey[1]; ...
[ "function", "(", "eventHash", ")", "{", "// coped from Backbone", "var", "delegateEventSplitter", "=", "/", "^(\\S+)\\s*(.*)$", "/", ";", "var", "namespacedEvents", "=", "{", "}", ";", "var", "behaviorId", "=", "this", ".", "cid", ";", "_", ".", "each", "(",...
Namespaces events in event hash @method __namespaceEvents @param eventHash {Object} to namespace @return {Object} with event namespaced with '.behavior' and the cid of the behavior @private
[ "Namespaces", "events", "in", "event", "hash" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L1965-L1978
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(name) { if (name === 'change' || name.indexOf('change:') === 0) { View.prototype.trigger.apply(this.view, arguments); } if (name.indexOf('change:hide:') === 0) { this.view.render(); } NestedCell.prototype.trigger.apply(this, arguments); }
javascript
function(name) { if (name === 'change' || name.indexOf('change:') === 0) { View.prototype.trigger.apply(this.view, arguments); } if (name.indexOf('change:hide:') === 0) { this.view.render(); } NestedCell.prototype.trigger.apply(this, arguments); }
[ "function", "(", "name", ")", "{", "if", "(", "name", "===", "'change'", "||", "name", ".", "indexOf", "(", "'change:'", ")", "===", "0", ")", "{", "View", ".", "prototype", ".", "trigger", ".", "apply", "(", "this", ".", "view", ",", "arguments", ...
Retrigger view state change events on the view as well. @method trigger @override
[ "Retrigger", "view", "state", "change", "events", "on", "the", "view", "as", "well", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L2107-L2115
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(el, template, context, opts) { opts = opts || {}; if (_.isString(template)) { opts.newHTML = template; } templateRenderer.render(el, template, context, opts); }
javascript
function(el, template, context, opts) { opts = opts || {}; if (_.isString(template)) { opts.newHTML = template; } templateRenderer.render(el, template, context, opts); }
[ "function", "(", "el", ",", "template", ",", "context", ",", "opts", ")", "{", "opts", "=", "opts", "||", "{", "}", ";", "if", "(", "_", ".", "isString", "(", "template", ")", ")", "{", "opts", ".", "newHTML", "=", "template", ";", "}", "template...
Hotswap rendering system reroute method. @method templateRender See Torso.templateRenderer#render for params
[ "Hotswap", "rendering", "system", "reroute", "method", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L2352-L2358
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { this.undelegateEvents(); // always undelegate events - backbone sometimes doesn't. Backbone.View.prototype.delegateEvents.call(this); this.__generateFeedbackBindings(); this.__generateFeedbackCellCallbacks(); _.each(this.getTrackedViews(), function(view) { if (view.isA...
javascript
function() { this.undelegateEvents(); // always undelegate events - backbone sometimes doesn't. Backbone.View.prototype.delegateEvents.call(this); this.__generateFeedbackBindings(); this.__generateFeedbackCellCallbacks(); _.each(this.getTrackedViews(), function(view) { if (view.isA...
[ "function", "(", ")", "{", "this", ".", "undelegateEvents", "(", ")", ";", "// always undelegate events - backbone sometimes doesn't.", "Backbone", ".", "View", ".", "prototype", ".", "delegateEvents", ".", "call", "(", "this", ")", ";", "this", ".", "__generateFe...
Overrides the base delegateEvents Binds DOM events with the view using events hash while also adding feedback event bindings @method delegateEvents
[ "Overrides", "the", "base", "delegateEvents", "Binds", "DOM", "events", "with", "the", "view", "using", "events", "hash", "while", "also", "adding", "feedback", "event", "bindings" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L2365-L2375
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { Backbone.View.prototype.undelegateEvents.call(this); _.each(this.getTrackedViews(), function(view) { view.undelegateEvents(); }); }
javascript
function() { Backbone.View.prototype.undelegateEvents.call(this); _.each(this.getTrackedViews(), function(view) { view.undelegateEvents(); }); }
[ "function", "(", ")", "{", "Backbone", ".", "View", ".", "prototype", ".", "undelegateEvents", ".", "call", "(", "this", ")", ";", "_", ".", "each", "(", "this", ".", "getTrackedViews", "(", ")", ",", "function", "(", "view", ")", "{", "view", ".", ...
Overrides undelegateEvents Unbinds DOM events from the view. @method undelegateEvents
[ "Overrides", "undelegateEvents", "Unbinds", "DOM", "events", "from", "the", "view", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L2382-L2387
train
vecnatechnologies/backbone-torso
torso-bundle.js
function($el, options) { options = options || {}; var view = this; if (!this.isAttachedToParent()) { this.__pendingAttachInfo = { $el: $el, options: options }; return this.render().done(function() { if (!view.__attachedCallbackInvoked && view.isAtt...
javascript
function($el, options) { options = options || {}; var view = this; if (!this.isAttachedToParent()) { this.__pendingAttachInfo = { $el: $el, options: options }; return this.render().done(function() { if (!view.__attachedCallbackInvoked && view.isAtt...
[ "function", "(", "$el", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "view", "=", "this", ";", "if", "(", "!", "this", ".", "isAttachedToParent", "(", ")", ")", "{", "this", ".", "__pendingAttachInfo", "=", "{", ...
If detached, will replace the element passed in with this view's element and activate the view. @param [$el] {jQuery element} the element to attach to. This element will be replaced with this view. If options.replaceMethod is provided, then this parameter is ignored. @param [options] {Object} optional options @param ...
[ "If", "detached", "will", "replace", "the", "element", "passed", "in", "with", "this", "view", "s", "element", "and", "activate", "the", "view", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L2401-L2417
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var wasAttached; if (this.isAttachedToParent()) { wasAttached = this.isAttached(); // Detach view from DOM this.trigger('before-dom-detach'); if (this.injectionSite) { this.$el.replaceWith(this.injectionSite); this.injectionSite = undefined; ...
javascript
function() { var wasAttached; if (this.isAttachedToParent()) { wasAttached = this.isAttached(); // Detach view from DOM this.trigger('before-dom-detach'); if (this.injectionSite) { this.$el.replaceWith(this.injectionSite); this.injectionSite = undefined; ...
[ "function", "(", ")", "{", "var", "wasAttached", ";", "if", "(", "this", ".", "isAttachedToParent", "(", ")", ")", "{", "wasAttached", "=", "this", ".", "isAttached", "(", ")", ";", "// Detach view from DOM", "this", ".", "trigger", "(", "'before-dom-detach'...
If attached, will detach the view from the DOM. This method will only separate this view from the DOM it was attached to, but it WILL invoke the _detach callback on each tracked view recursively. @method detach
[ "If", "attached", "will", "detach", "the", "view", "from", "the", "DOM", ".", "This", "method", "will", "only", "separate", "this", "view", "from", "the", "DOM", "it", "was", "attached", "to", "but", "it", "WILL", "invoke", "the", "_detach", "callback", ...
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L2511-L2529
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { this.trigger('before-dispose'); this.trigger('before-dispose-callback'); this._dispose(); // Detach DOM and deactivate the view this.detach(); this.deactivate(); // Clean up child views first this.__disposeChildViews(); // Remove view from DOM ...
javascript
function() { this.trigger('before-dispose'); this.trigger('before-dispose-callback'); this._dispose(); // Detach DOM and deactivate the view this.detach(); this.deactivate(); // Clean up child views first this.__disposeChildViews(); // Remove view from DOM ...
[ "function", "(", ")", "{", "this", ".", "trigger", "(", "'before-dispose'", ")", ";", "this", ".", "trigger", "(", "'before-dispose-callback'", ")", ";", "this", ".", "_dispose", "(", ")", ";", "// Detach DOM and deactivate the view", "this", ".", "detach", "(...
Removes all listeners, disposes children views, stops listening to events, removes DOM. After dispose is called, the view can be safely garbage collected. Called while recursively removing views from the hierarchy. @method dispose
[ "Removes", "all", "listeners", "disposes", "children", "views", "stops", "listening", "to", "events", "removes", "DOM", ".", "After", "dispose", "is", "called", "the", "view", "can", "be", "safely", "garbage", "collected", ".", "Called", "while", "recursively", ...
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L2609-L2643
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(view, options) { options = options || {}; this.unregisterTrackedView(view); if (options.child || !options.shared) { this.__childViews[view.cid] = view; } else { this.__sharedViews[view.cid] = view; } return view; }
javascript
function(view, options) { options = options || {}; this.unregisterTrackedView(view); if (options.child || !options.shared) { this.__childViews[view.cid] = view; } else { this.__sharedViews[view.cid] = view; } return view; }
[ "function", "(", "view", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "this", ".", "unregisterTrackedView", "(", "view", ")", ";", "if", "(", "options", ".", "child", "||", "!", "options", ".", "shared", ")", "{", "this",...
Binds the view as a tracked view - any recursive calls like activate, deactivate, or dispose will be done to the tracked view as well. Except dispose for shared views. This method defaults to register the view as a child view unless specified by options.shared. @param view {View} the tracked view @param [options={}] {...
[ "Binds", "the", "view", "as", "a", "tracked", "view", "-", "any", "recursive", "calls", "like", "activate", "deactivate", "or", "dispose", "will", "be", "done", "to", "the", "tracked", "view", "as", "well", ".", "Except", "dispose", "for", "shared", "views...
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L2708-L2717
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(options) { var trackedViewsHash = this.getTrackedViews(options); _.each(trackedViewsHash, function(view) { this.unregisterTrackedView(view, options); }, this); }
javascript
function(options) { var trackedViewsHash = this.getTrackedViews(options); _.each(trackedViewsHash, function(view) { this.unregisterTrackedView(view, options); }, this); }
[ "function", "(", "options", ")", "{", "var", "trackedViewsHash", "=", "this", ".", "getTrackedViews", "(", "options", ")", ";", "_", ".", "each", "(", "trackedViewsHash", ",", "function", "(", "view", ")", "{", "this", ".", "unregisterTrackedView", "(", "v...
Unbinds all tracked view - no recursive calls will be made to this shared view You can limit the types of views that will be unregistered by using the options parameter. @param view {View} the shared view @param [options={}] {Object} Optional options. @param [options.shared=false] {Boolean} If true, unregister only th...
[ "Unbinds", "all", "tracked", "view", "-", "no", "recursive", "calls", "will", "be", "made", "to", "this", "shared", "view", "You", "can", "limit", "the", "types", "of", "views", "that", "will", "be", "unregistered", "by", "using", "the", "options", "parame...
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L2742-L2747
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(to, evt, indexMap) { var result, feedbackToInvoke = _.find(this.feedback, function(feedback) { var toToCheck = feedback.to; if (_.isArray(toToCheck)) { return _.contains(toToCheck, to); } else { return to === toToCheck; } }),...
javascript
function(to, evt, indexMap) { var result, feedbackToInvoke = _.find(this.feedback, function(feedback) { var toToCheck = feedback.to; if (_.isArray(toToCheck)) { return _.contains(toToCheck, to); } else { return to === toToCheck; } }),...
[ "function", "(", "to", ",", "evt", ",", "indexMap", ")", "{", "var", "result", ",", "feedbackToInvoke", "=", "_", ".", "find", "(", "this", ".", "feedback", ",", "function", "(", "feedback", ")", "{", "var", "toToCheck", "=", "feedback", ".", "to", "...
Invokes a feedback entry's "then" method @param to {String} the "to" field corresponding to the feedback entry to be invoked. @param [evt] {Event} the event to be passed to the "then" method @param [indexMap] {Object} a map from index variable name to index value. Needed for "to" fields with array notation. @method inv...
[ "Invokes", "a", "feedback", "entry", "s", "then", "method" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L2788-L2806
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(viewOptions) { var view = this; if (!_.isEmpty(this.behaviors)) { view.__behaviorInstances = {}; _.each(this.behaviors, function(behaviorDefinition, alias) { if (!_.has(behaviorDefinition, 'behavior')) { behaviorDefinition = {behavior: behaviorDefinition}; ...
javascript
function(viewOptions) { var view = this; if (!_.isEmpty(this.behaviors)) { view.__behaviorInstances = {}; _.each(this.behaviors, function(behaviorDefinition, alias) { if (!_.has(behaviorDefinition, 'behavior')) { behaviorDefinition = {behavior: behaviorDefinition}; ...
[ "function", "(", "viewOptions", ")", "{", "var", "view", "=", "this", ";", "if", "(", "!", "_", ".", "isEmpty", "(", "this", ".", "behaviors", ")", ")", "{", "view", ".", "__behaviorInstances", "=", "{", "}", ";", "_", ".", "each", "(", "this", "...
Initializes the behaviors @method __initializeBehaviors
[ "Initializes", "the", "behaviors" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L2966-L3004
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(injectionSiteName, previousView, newView, options) { var newInjectionSite, currentPromise, previousDeferred = $.Deferred(); this.attachView(injectionSiteName, previousView, options); options.cachedInjectionSite = previousView.injectionSite; newInjectionSite = options.newInjectio...
javascript
function(injectionSiteName, previousView, newView, options) { var newInjectionSite, currentPromise, previousDeferred = $.Deferred(); this.attachView(injectionSiteName, previousView, options); options.cachedInjectionSite = previousView.injectionSite; newInjectionSite = options.newInjectio...
[ "function", "(", "injectionSiteName", ",", "previousView", ",", "newView", ",", "options", ")", "{", "var", "newInjectionSite", ",", "currentPromise", ",", "previousDeferred", "=", "$", ".", "Deferred", "(", ")", ";", "this", ".", "attachView", "(", "injection...
Will transition out previousView at the same time as transitioning in newView. @method __performTwoWayTransition @param injectionSiteName {String} The name of the injection site in the template. This is the value corresponding to the attribute "inject". @param previousView {View} the view that should be transitioned ou...
[ "Will", "transition", "out", "previousView", "at", "the", "same", "time", "as", "transitioning", "in", "newView", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L3121-L3143
train
vecnatechnologies/backbone-torso
torso-bundle.js
function($el, newView, options) { var currentDeferred = $.Deferred(), parentView = this; options = _.extend({}, options); _.defaults(options, { parentView: this, newView: newView }); newView.transitionIn(function() { parentView.attachView($el, newView, optio...
javascript
function($el, newView, options) { var currentDeferred = $.Deferred(), parentView = this; options = _.extend({}, options); _.defaults(options, { parentView: this, newView: newView }); newView.transitionIn(function() { parentView.attachView($el, newView, optio...
[ "function", "(", "$el", ",", "newView", ",", "options", ")", "{", "var", "currentDeferred", "=", "$", ".", "Deferred", "(", ")", ",", "parentView", "=", "this", ";", "options", "=", "_", ".", "extend", "(", "{", "}", ",", "options", ")", ";", "_", ...
Simliar to this.attachView except it utilizes the new view's transitionIn method instead of just attaching the view. This method is invoked on the parent view to attach a tracked view where the transitionIn method defines how a tracked view is brought onto the page. @param $el {jQuery element} the element to attach to....
[ "Simliar", "to", "this", ".", "attachView", "except", "it", "utilizes", "the", "new", "view", "s", "transitionIn", "method", "instead", "of", "just", "attaching", "the", "view", ".", "This", "method", "is", "invoked", "on", "the", "parent", "view", "to", "...
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L3157-L3169
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var parentView = this; this.__injectionSiteMap = {}; this.__lastTrackedViews = {}; _.each(this.getTrackedViews(), function(view) { if (view.isAttachedToParent() && view.injectionSite) { parentView.__injectionSiteMap[view.injectionSite.attr('inject')] = view; ...
javascript
function() { var parentView = this; this.__injectionSiteMap = {}; this.__lastTrackedViews = {}; _.each(this.getTrackedViews(), function(view) { if (view.isAttachedToParent() && view.injectionSite) { parentView.__injectionSiteMap[view.injectionSite.attr('inject')] = view; ...
[ "function", "(", ")", "{", "var", "parentView", "=", "this", ";", "this", ".", "__injectionSiteMap", "=", "{", "}", ";", "this", ".", "__lastTrackedViews", "=", "{", "}", ";", "_", ".", "each", "(", "this", ".", "getTrackedViews", "(", ")", ",", "fun...
Used internally by Torso.View to keep a cache of tracked views and their current injection sites before detaching during render logic. @private @method __updateInjectionSiteMap
[ "Used", "internally", "by", "Torso", ".", "View", "to", "keep", "a", "cache", "of", "tracked", "views", "and", "their", "current", "injection", "sites", "before", "detaching", "during", "render", "logic", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L3203-L3213
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { // Need to check if each view is attached because there is no guarentee that if parent is attached, child is attached. if (!this.__attachedCallbackInvoked) { this.trigger('before-attached-callback'); this._attached(); this.__attachedCallbackInvoked = true; _.each...
javascript
function() { // Need to check if each view is attached because there is no guarentee that if parent is attached, child is attached. if (!this.__attachedCallbackInvoked) { this.trigger('before-attached-callback'); this._attached(); this.__attachedCallbackInvoked = true; _.each...
[ "function", "(", ")", "{", "// Need to check if each view is attached because there is no guarentee that if parent is attached, child is attached.", "if", "(", "!", "this", ".", "__attachedCallbackInvoked", ")", "{", "this", ".", "trigger", "(", "'before-attached-callback'", ")",...
Call this method when a view is attached to the DOM. It is recursive to child views, but checks whether each child view is attached. @method __invokeAttached @private
[ "Call", "this", "method", "when", "a", "view", "is", "attached", "to", "the", "DOM", ".", "It", "is", "recursive", "to", "child", "views", "but", "checks", "whether", "each", "child", "view", "is", "attached", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L3237-L3249
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { if (this.__attachedCallbackInvoked) { this.trigger('before-detached-callback'); this._detached(); this.__attachedCallbackInvoked = false; } _.each(this.getTrackedViews(), function(view) { // If the tracked view is currently attached to the parent, then invo...
javascript
function() { if (this.__attachedCallbackInvoked) { this.trigger('before-detached-callback'); this._detached(); this.__attachedCallbackInvoked = false; } _.each(this.getTrackedViews(), function(view) { // If the tracked view is currently attached to the parent, then invo...
[ "function", "(", ")", "{", "if", "(", "this", ".", "__attachedCallbackInvoked", ")", "{", "this", ".", "trigger", "(", "'before-detached-callback'", ")", ";", "this", ".", "_detached", "(", ")", ";", "this", ".", "__attachedCallbackInvoked", "=", "false", ";...
Call this method when a view is detached from the DOM. It is recursive to child views. @method __invokeDetached
[ "Call", "this", "method", "when", "a", "view", "is", "detached", "from", "the", "DOM", ".", "It", "is", "recursive", "to", "child", "views", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L3255-L3267
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(result, feedbackCellField) { var newState = $.extend({}, result); this.feedbackCell.set(feedbackCellField, newState, {silent: true}); this.feedbackCell.trigger('change:' + feedbackCellField); }
javascript
function(result, feedbackCellField) { var newState = $.extend({}, result); this.feedbackCell.set(feedbackCellField, newState, {silent: true}); this.feedbackCell.trigger('change:' + feedbackCellField); }
[ "function", "(", "result", ",", "feedbackCellField", ")", "{", "var", "newState", "=", "$", ".", "extend", "(", "{", "}", ",", "result", ")", ";", "this", ".", "feedbackCell", ".", "set", "(", "feedbackCellField", ",", "newState", ",", "{", "silent", "...
Processes the result of the then method. Adds to the feedback cell. @param result {Object} the result of the then method @param feedbackCellField {Object} the name of the feedbackCellField, typically the "to" value. @private @method __processFeedbackThenResult
[ "Processes", "the", "result", "of", "the", "then", "method", ".", "Adds", "to", "the", "feedback", "cell", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L3323-L3327
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(bindInfo, eventKey) { return function() { var result, args = [{ args: arguments, type: eventKey }]; args.push(bindInfo.indices); result = bindInfo.fn.apply(this, args); this.__processFeedbackThenResult(result, bindInfo.fe...
javascript
function(bindInfo, eventKey) { return function() { var result, args = [{ args: arguments, type: eventKey }]; args.push(bindInfo.indices); result = bindInfo.fn.apply(this, args); this.__processFeedbackThenResult(result, bindInfo.fe...
[ "function", "(", "bindInfo", ",", "eventKey", ")", "{", "return", "function", "(", ")", "{", "var", "result", ",", "args", "=", "[", "{", "args", ":", "arguments", ",", "type", ":", "eventKey", "}", "]", ";", "args", ".", "push", "(", "bindInfo", "...
Returns a properly wrapped "then" using a configuration object "bindInfo" and an "eventKey" that will be passed as the type @param bindInfo {Object} @param bindInfo.feedbackCellField the property name of the feedback cell to store the "then" instructions @param bindInfo.fn the original "then" function @param [bin...
[ "Returns", "a", "properly", "wrapped", "then", "using", "a", "configuration", "object", "bindInfo", "and", "an", "eventKey", "that", "will", "be", "passed", "as", "the", "type" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L3448-L3459
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(whenMap, indexMap) { var self = this, events = []; _.each(whenMap, function(whenEvents, whenField) { var substitutedWhenField, qualifiedFields = [whenField], useAtNotation = (whenField.charAt(0) === '@'); if (whenField !== 'on' || whenField !== 'li...
javascript
function(whenMap, indexMap) { var self = this, events = []; _.each(whenMap, function(whenEvents, whenField) { var substitutedWhenField, qualifiedFields = [whenField], useAtNotation = (whenField.charAt(0) === '@'); if (whenField !== 'on' || whenField !== 'li...
[ "function", "(", "whenMap", ",", "indexMap", ")", "{", "var", "self", "=", "this", ",", "events", "=", "[", "]", ";", "_", ".", "each", "(", "whenMap", ",", "function", "(", "whenEvents", ",", "whenField", ")", "{", "var", "substitutedWhenField", ",", ...
Generates the events needed to listen to the feedback's when methods. A when event is only created if the appropriate element exist on the page @param whenMap the collection of "when"'s for a given feedback @param indexMap map from variable names to values when substituting array notation @return the events that were g...
[ "Generates", "the", "events", "needed", "to", "listen", "to", "the", "feedback", "s", "when", "methods", ".", "A", "when", "event", "is", "only", "created", "if", "the", "appropriate", "element", "exist", "on", "the", "page" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L3493-L3522
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(model, attr) { var attrValidationSet = model.validation ? _.result(model, 'validation')[attr] || {} : {}; // If the validator is a function or a string, wrap it in a function validator if (_.isFunction(attrValidationSet) || _.isString(attrValidationSet)) { attrValidationSet = { ...
javascript
function(model, attr) { var attrValidationSet = model.validation ? _.result(model, 'validation')[attr] || {} : {}; // If the validator is a function or a string, wrap it in a function validator if (_.isFunction(attrValidationSet) || _.isString(attrValidationSet)) { attrValidationSet = { ...
[ "function", "(", "model", ",", "attr", ")", "{", "var", "attrValidationSet", "=", "model", ".", "validation", "?", "_", ".", "result", "(", "model", ",", "'validation'", ")", "[", "attr", "]", "||", "{", "}", ":", "{", "}", ";", "// If the validator is...
Looks on the model for validations for a specified attribute. Returns an array of any validators defined, or an empty array if none is defined.
[ "Looks", "on", "the", "model", "for", "validations", "for", "a", "specified", "attribute", ".", "Returns", "an", "array", "of", "any", "validators", "defined", "or", "an", "empty", "array", "if", "none", "is", "defined", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L3762-L3791
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(model, attrs, validatedAttrs) { var error, invalidAttrs = {}, isValid = true, computed = _.clone(attrs); _.each(validatedAttrs, function(val, attr) { error = validateAttrWithOpenArray(model, attr, val, computed); if (error) { invalidAttrs[att...
javascript
function(model, attrs, validatedAttrs) { var error, invalidAttrs = {}, isValid = true, computed = _.clone(attrs); _.each(validatedAttrs, function(val, attr) { error = validateAttrWithOpenArray(model, attr, val, computed); if (error) { invalidAttrs[att...
[ "function", "(", "model", ",", "attrs", ",", "validatedAttrs", ")", "{", "var", "error", ",", "invalidAttrs", "=", "{", "}", ",", "isValid", "=", "true", ",", "computed", "=", "_", ".", "clone", "(", "attrs", ")", ";", "_", ".", "each", "(", "valid...
Loops through the model's attributes and validates the specified attrs. Returns and object containing names of invalid attributes as well as error messages.
[ "Loops", "through", "the", "model", "s", "attributes", "and", "validates", "the", "specified", "attrs", ".", "Returns", "and", "object", "containing", "names", "of", "invalid", "attributes", "as", "well", "as", "error", "messages", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L3933-L3951
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(model, value, attr) { var indices, validators, validations = model.validation ? _.result(model, 'validation') || {} : {}; // If the validations hash contains an entry for the attr if (_.contains(_.keys(validations), attr)) { return validateAttrWithOpenArray(model, attr, value,...
javascript
function(model, value, attr) { var indices, validators, validations = model.validation ? _.result(model, 'validation') || {} : {}; // If the validations hash contains an entry for the attr if (_.contains(_.keys(validations), attr)) { return validateAttrWithOpenArray(model, attr, value,...
[ "function", "(", "model", ",", "value", ",", "attr", ")", "{", "var", "indices", ",", "validators", ",", "validations", "=", "model", ".", "validation", "?", "_", ".", "result", "(", "model", ",", "'validation'", ")", "||", "{", "}", ":", "{", "}", ...
Validates attribute without open array notation.
[ "Validates", "attribute", "without", "open", "array", "notation", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L3954-L3966
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(attr, value) { var self = this, result = {}, error; if (_.isArray(attr)) { _.each(attr, function(attr) { error = self.preValidate(attr); if (error) { result[attr] = error; } }); ...
javascript
function(attr, value) { var self = this, result = {}, error; if (_.isArray(attr)) { _.each(attr, function(attr) { error = self.preValidate(attr); if (error) { result[attr] = error; } }); ...
[ "function", "(", "attr", ",", "value", ")", "{", "var", "self", "=", "this", ",", "result", "=", "{", "}", ",", "error", ";", "if", "(", "_", ".", "isArray", "(", "attr", ")", ")", "{", "_", ".", "each", "(", "attr", ",", "function", "(", "at...
Check whether an attribute or a set of attributes are valid. It will default to use the model's current values but you can pass in different values to use in the validation process instead. @param attr {String or Object or Array} Either the name of the attribute, an array containing many attribute names, or on object w...
[ "Check", "whether", "an", "attribute", "or", "a", "set", "of", "attributes", "are", "valid", ".", "It", "will", "default", "to", "use", "the", "model", "s", "current", "values", "but", "you", "can", "pass", "in", "different", "values", "to", "use", "in",...
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L3982-L4008
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(value, attr, fn, model, computed, indices) { return fn.call(this, value, attr, model, computed, indices); }
javascript
function(value, attr, fn, model, computed, indices) { return fn.call(this, value, attr, model, computed, indices); }
[ "function", "(", "value", ",", "attr", ",", "fn", ",", "model", ",", "computed", ",", "indices", ")", "{", "return", "fn", ".", "call", "(", "this", ",", "value", ",", "attr", ",", "model", ",", "computed", ",", "indices", ")", ";", "}" ]
Allows the creation of an inline function that uses the validators context instead of the model context.
[ "Allows", "the", "creation", "of", "an", "inline", "function", "that", "uses", "the", "validators", "context", "instead", "of", "the", "model", "context", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L4241-L4243
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(value, attr, required, model, computed) { var isRequired = _.isFunction(required) ? required.call(model, value, attr, computed) : required; if(!isRequired && !hasValue(value)) { return false; // overrides all other validators } if (isRequired && !hasValue(value)) { ...
javascript
function(value, attr, required, model, computed) { var isRequired = _.isFunction(required) ? required.call(model, value, attr, computed) : required; if(!isRequired && !hasValue(value)) { return false; // overrides all other validators } if (isRequired && !hasValue(value)) { ...
[ "function", "(", "value", ",", "attr", ",", "required", ",", "model", ",", "computed", ")", "{", "var", "isRequired", "=", "_", ".", "isFunction", "(", "required", ")", "?", "required", ".", "call", "(", "model", ",", "value", ",", "attr", ",", "comp...
Required validator Validates if the attribute is required or not This can be specified as either a boolean value or a function that returns a boolean value
[ "Required", "validator", "Validates", "if", "the", "attribute", "is", "required", "or", "not", "This", "can", "be", "specified", "as", "either", "a", "boolean", "value", "or", "a", "function", "that", "returns", "a", "boolean", "value" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L4248-L4256
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(value, attr, maxValue, model) { if (!isNumber(value) || value > maxValue) { return this.format(getMessageKey(this.msgKey, defaultMessages.max), this.formatLabel(attr, model), maxValue); } }
javascript
function(value, attr, maxValue, model) { if (!isNumber(value) || value > maxValue) { return this.format(getMessageKey(this.msgKey, defaultMessages.max), this.formatLabel(attr, model), maxValue); } }
[ "function", "(", "value", ",", "attr", ",", "maxValue", ",", "model", ")", "{", "if", "(", "!", "isNumber", "(", "value", ")", "||", "value", ">", "maxValue", ")", "{", "return", "this", ".", "format", "(", "getMessageKey", "(", "this", ".", "msgKey"...
Max validator Validates that the value has to be a number and equal to or less than the max value specified
[ "Max", "validator", "Validates", "that", "the", "value", "has", "to", "be", "a", "number", "and", "equal", "to", "or", "less", "than", "the", "max", "value", "specified" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L4279-L4283
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(value, attr, range, model) { if(!isNumber(value) || value < range[0] || value > range[1]) { return this.format(getMessageKey(this.msgKey, defaultMessages.range), this.formatLabel(attr, model), range[0], range[1]); } }
javascript
function(value, attr, range, model) { if(!isNumber(value) || value < range[0] || value > range[1]) { return this.format(getMessageKey(this.msgKey, defaultMessages.range), this.formatLabel(attr, model), range[0], range[1]); } }
[ "function", "(", "value", ",", "attr", ",", "range", ",", "model", ")", "{", "if", "(", "!", "isNumber", "(", "value", ")", "||", "value", "<", "range", "[", "0", "]", "||", "value", ">", "range", "[", "1", "]", ")", "{", "return", "this", ".",...
Range validator Validates that the value has to be a number and equal to or between the two numbers specified
[ "Range", "validator", "Validates", "that", "the", "value", "has", "to", "be", "a", "number", "and", "equal", "to", "or", "between", "the", "two", "numbers", "specified" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L4288-L4292
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(value, attr, minLength, model) { if (!_.isString(value) || value.length < minLength) { return this.format(getMessageKey(this.msgKey, defaultMessages.minLength), this.formatLabel(attr, model), minLength); } }
javascript
function(value, attr, minLength, model) { if (!_.isString(value) || value.length < minLength) { return this.format(getMessageKey(this.msgKey, defaultMessages.minLength), this.formatLabel(attr, model), minLength); } }
[ "function", "(", "value", ",", "attr", ",", "minLength", ",", "model", ")", "{", "if", "(", "!", "_", ".", "isString", "(", "value", ")", "||", "value", ".", "length", "<", "minLength", ")", "{", "return", "this", ".", "format", "(", "getMessageKey",...
Min length validator Validates that the value has to be a string with length equal to or greater than the min length value specified
[ "Min", "length", "validator", "Validates", "that", "the", "value", "has", "to", "be", "a", "string", "with", "length", "equal", "to", "or", "greater", "than", "the", "min", "length", "value", "specified" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L4306-L4310
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(value, attr, maxLength, model) { if (!_.isString(value) || value.length > maxLength) { return this.format(getMessageKey(this.msgKey, defaultMessages.maxLength), this.formatLabel(attr, model), maxLength); } }
javascript
function(value, attr, maxLength, model) { if (!_.isString(value) || value.length > maxLength) { return this.format(getMessageKey(this.msgKey, defaultMessages.maxLength), this.formatLabel(attr, model), maxLength); } }
[ "function", "(", "value", ",", "attr", ",", "maxLength", ",", "model", ")", "{", "if", "(", "!", "_", ".", "isString", "(", "value", ")", "||", "value", ".", "length", ">", "maxLength", ")", "{", "return", "this", ".", "format", "(", "getMessageKey",...
Max length validator Validates that the value has to be a string with length equal to or less than the max length value specified
[ "Max", "length", "validator", "Validates", "that", "the", "value", "has", "to", "be", "a", "string", "with", "length", "equal", "to", "or", "less", "than", "the", "max", "length", "value", "specified" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L4315-L4319
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(value, attr, range, model) { if (!_.isString(value) || value.length < range[0] || value.length > range[1]) { return this.format(getMessageKey(this.msgKey, defaultMessages.rangeLength), this.formatLabel(attr, model), range[0], range[1]); } }
javascript
function(value, attr, range, model) { if (!_.isString(value) || value.length < range[0] || value.length > range[1]) { return this.format(getMessageKey(this.msgKey, defaultMessages.rangeLength), this.formatLabel(attr, model), range[0], range[1]); } }
[ "function", "(", "value", ",", "attr", ",", "range", ",", "model", ")", "{", "if", "(", "!", "_", ".", "isString", "(", "value", ")", "||", "value", ".", "length", "<", "range", "[", "0", "]", "||", "value", ".", "length", ">", "range", "[", "1...
Range length validator Validates that the value has to be a string and equal to or between the two numbers specified
[ "Range", "length", "validator", "Validates", "that", "the", "value", "has", "to", "be", "a", "string", "and", "equal", "to", "or", "between", "the", "two", "numbers", "specified" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L4324-L4328
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(value, attr, pattern, model) { if (!hasValue(value) || !value.toString().match(defaultPatterns[pattern] || pattern)) { return this.format(getMessageKey(this.msgKey, defaultMessages[pattern]) || defaultMessages.inlinePattern, this.formatLabel(attr, model), pattern); } }
javascript
function(value, attr, pattern, model) { if (!hasValue(value) || !value.toString().match(defaultPatterns[pattern] || pattern)) { return this.format(getMessageKey(this.msgKey, defaultMessages[pattern]) || defaultMessages.inlinePattern, this.formatLabel(attr, model), pattern); } }
[ "function", "(", "value", ",", "attr", ",", "pattern", ",", "model", ")", "{", "if", "(", "!", "hasValue", "(", "value", ")", "||", "!", "value", ".", "toString", "(", ")", ".", "match", "(", "defaultPatterns", "[", "pattern", "]", "||", "pattern", ...
Pattern validator Validates that the value has to match the pattern specified. Can be a regular expression or the name of one of the built in patterns
[ "Pattern", "validator", "Validates", "that", "the", "value", "has", "to", "match", "the", "pattern", "specified", ".", "Can", "be", "a", "regular", "expression", "or", "the", "name", "of", "one", "of", "the", "built", "in", "patterns" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L4351-L4355
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(alias, model, copy) { this.__currentObjectModels[alias] = model; this.__updateCache(model); this.resetUpdating(); if (copy) { _.each(this.getMappings(), function(config, mappingAlias) { var modelAliases; if (alias === mappingAlias) { this.__pull(m...
javascript
function(alias, model, copy) { this.__currentObjectModels[alias] = model; this.__updateCache(model); this.resetUpdating(); if (copy) { _.each(this.getMappings(), function(config, mappingAlias) { var modelAliases; if (alias === mappingAlias) { this.__pull(m...
[ "function", "(", "alias", ",", "model", ",", "copy", ")", "{", "this", ".", "__currentObjectModels", "[", "alias", "]", "=", "model", ";", "this", ".", "__updateCache", "(", "model", ")", ";", "this", ".", "resetUpdating", "(", ")", ";", "if", "(", "...
Update or create a binding between an object model and an alias. @method trackModel @param alias {String} the alias/name to bind to. @param model {Backbone Model instance} the model to be bound. Mappings referencing this alias will start applying to this model. @param [copy=false] {Boolean} if true, the form model will...
[ "Update", "or", "create", "a", "binding", "between", "an", "object", "model", "and", "an", "alias", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L4662-L4680
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(models, copy) { _.each(models, function(instance, alias) { this.trackModel(alias, instance, copy); }, this); }
javascript
function(models, copy) { _.each(models, function(instance, alias) { this.trackModel(alias, instance, copy); }, this); }
[ "function", "(", "models", ",", "copy", ")", "{", "_", ".", "each", "(", "models", ",", "function", "(", "instance", ",", "alias", ")", "{", "this", ".", "trackModel", "(", "alias", ",", "instance", ",", "copy", ")", ";", "}", ",", "this", ")", "...
Binds multiple models to their aliases. @method trackModels @param models {Map from String to Backbone Model instances} A map from alias/name to model to be bound to that alias. @param [copy=false] {Boolean} if true, the form model will perform a pull on any mapping using these models.
[ "Binds", "multiple", "models", "to", "their", "aliases", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L4696-L4700
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(aliasOrModel) { var model, alias = this.__findAlias(aliasOrModel); if (alias) { model = this.__currentObjectModels[alias]; delete this.__currentObjectModels[alias]; this.__updateCache(model); } this.resetUpdating(); }
javascript
function(aliasOrModel) { var model, alias = this.__findAlias(aliasOrModel); if (alias) { model = this.__currentObjectModels[alias]; delete this.__currentObjectModels[alias]; this.__updateCache(model); } this.resetUpdating(); }
[ "function", "(", "aliasOrModel", ")", "{", "var", "model", ",", "alias", "=", "this", ".", "__findAlias", "(", "aliasOrModel", ")", ";", "if", "(", "alias", ")", "{", "model", "=", "this", ".", "__currentObjectModels", "[", "alias", "]", ";", "delete", ...
Removes the binding between a model alias and a model instance. Effectively stops tracking that model. @method untrackModel @param aliasOrModel {String or Backbone Model instance} If a string is given, it will unset the model using that alias. If a model instance is given, it will unbind whatever alias is currently bou...
[ "Removes", "the", "binding", "between", "a", "model", "alias", "and", "a", "model", "instance", ".", "Effectively", "stops", "tracking", "that", "model", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L4717-L4726
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { _.each(this.__currentUpdateEvents, function(eventConfig) { this.stopListening(eventConfig.model, eventConfig.eventName); }, this); this.__currentUpdateEvents = []; }
javascript
function() { _.each(this.__currentUpdateEvents, function(eventConfig) { this.stopListening(eventConfig.model, eventConfig.eventName); }, this); this.__currentUpdateEvents = []; }
[ "function", "(", ")", "{", "_", ".", "each", "(", "this", ".", "__currentUpdateEvents", ",", "function", "(", "eventConfig", ")", "{", "this", ".", "stopListening", "(", "eventConfig", ".", "model", ",", "eventConfig", ".", "eventName", ")", ";", "}", ",...
This will stop the form model from listening to its object models. @method stopUpdating
[ "This", "will", "stop", "the", "form", "model", "from", "listening", "to", "its", "object", "models", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L4863-L4868
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(computedAlias) { var hasAllModels = true, config = this.getMapping(computedAlias), modelConfigs = []; _.each(this.__getModelAliases(computedAlias), function(modelAlias) { var modelConfig = this.__createModelConfig(modelAlias, config.mapping[modelAlias]); if (modelCon...
javascript
function(computedAlias) { var hasAllModels = true, config = this.getMapping(computedAlias), modelConfigs = []; _.each(this.__getModelAliases(computedAlias), function(modelAlias) { var modelConfig = this.__createModelConfig(modelAlias, config.mapping[modelAlias]); if (modelCon...
[ "function", "(", "computedAlias", ")", "{", "var", "hasAllModels", "=", "true", ",", "config", "=", "this", ".", "getMapping", "(", "computedAlias", ")", ",", "modelConfigs", "=", "[", "]", ";", "_", ".", "each", "(", "this", ".", "__getModelAliases", "(...
Repackages a computed mapping to be easier consumed by methods wanting the model mappings tied to the model instances. Returns a list of objects that contain the model instance and the mapping for that model. @method __getComputedModelConfigs @param computedAlias {String} the name/alias used for this computed @return {...
[ "Repackages", "a", "computed", "mapping", "to", "be", "easier", "consumed", "by", "methods", "wanting", "the", "model", "mappings", "tied", "to", "the", "model", "instances", ".", "Returns", "a", "list", "of", "objects", "that", "contain", "the", "model", "i...
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5019-L5032
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(deferred, options) { var staleModels, formModel = this, responsesSucceeded = 0, responsesFailed = 0, responses = {}, oldValues = {}, models = formModel.getTrackedModels(), numberOfSaves = models.length; // If we're not forcing a save, then thr...
javascript
function(deferred, options) { var staleModels, formModel = this, responsesSucceeded = 0, responsesFailed = 0, responses = {}, oldValues = {}, models = formModel.getTrackedModels(), numberOfSaves = models.length; // If we're not forcing a save, then thr...
[ "function", "(", "deferred", ",", "options", ")", "{", "var", "staleModels", ",", "formModel", "=", "this", ",", "responsesSucceeded", "=", "0", ",", "responsesFailed", "=", "0", ",", "responses", "=", "{", "}", ",", "oldValues", "=", "{", "}", ",", "m...
Pushes the form model values to the object models it is tracking and invokes save on each one. Returns a promise. @param [options] {Object} @param [options.rollback=true] {Boolean} if true, when any object model fails to save, it will revert the object model attributes to the state they were before calling save. NOTE: ...
[ "Pushes", "the", "form", "model", "values", "to", "the", "object", "models", "it", "is", "tracking", "and", "invokes", "save", "on", "each", "one", ".", "Returns", "a", "promise", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5050-L5112
train
vecnatechnologies/backbone-torso
torso-bundle.js
responseCallback
function responseCallback(response, model, success) { // Add response to a hash that will eventually be returned through the promise responses[model.cid] = { success: success, response: response }; // If we have reached the total of number of expected responses,...
javascript
function responseCallback(response, model, success) { // Add response to a hash that will eventually be returned through the promise responses[model.cid] = { success: success, response: response }; // If we have reached the total of number of expected responses,...
[ "function", "responseCallback", "(", "response", ",", "model", ",", "success", ")", "{", "// Add response to a hash that will eventually be returned through the promise", "responses", "[", "model", ".", "cid", "]", "=", "{", "success", ":", "success", ",", "response", ...
Callback for each response
[ "Callback", "for", "each", "response" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5070-L5095
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(alias) { var config = this.getMapping(alias); if (config.computed && config.mapping.pull) { this.__invokeComputedPull.call({formModel: this, alias: alias}); } else if (config.computed) { var modelAliases = this.__getModelAliases(alias); _.each(modelAliases, function(mo...
javascript
function(alias) { var config = this.getMapping(alias); if (config.computed && config.mapping.pull) { this.__invokeComputedPull.call({formModel: this, alias: alias}); } else if (config.computed) { var modelAliases = this.__getModelAliases(alias); _.each(modelAliases, function(mo...
[ "function", "(", "alias", ")", "{", "var", "config", "=", "this", ".", "getMapping", "(", "alias", ")", ";", "if", "(", "config", ".", "computed", "&&", "config", ".", "mapping", ".", "pull", ")", "{", "this", ".", "__invokeComputedPull", ".", "call", ...
Pulls in new information from tracked models using the mapping defined by the given alias. This works for both model mappings and computed value mappings @method __pull @param alias {String} the name of the mapping that will be used during the pull @private
[ "Pulls", "in", "new", "information", "from", "tracked", "models", "using", "the", "mapping", "defined", "by", "the", "given", "alias", ".", "This", "works", "for", "both", "model", "mappings", "and", "computed", "value", "mappings" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5121-L5139
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(alias) { var config = this.getMapping(alias); if (config.computed && config.mapping.push) { var models = this.__getComputedModels(alias); if (models) { config.mapping.push.call(this, models); } } else if (config.computed) { var modelAliases = this.__g...
javascript
function(alias) { var config = this.getMapping(alias); if (config.computed && config.mapping.push) { var models = this.__getComputedModels(alias); if (models) { config.mapping.push.call(this, models); } } else if (config.computed) { var modelAliases = this.__g...
[ "function", "(", "alias", ")", "{", "var", "config", "=", "this", ".", "getMapping", "(", "alias", ")", ";", "if", "(", "config", ".", "computed", "&&", "config", ".", "mapping", ".", "push", ")", "{", "var", "models", "=", "this", ".", "__getCompute...
Pushes form model information to tracked models using the mapping defined by the given alias. This works for both model mappings and computed value mappings @method __push @param alias {String} the name of the mapping that will be used during the push @private
[ "Pushes", "form", "model", "information", "to", "tracked", "models", "using", "the", "mapping", "defined", "by", "the", "given", "alias", ".", "This", "works", "for", "both", "model", "mappings", "and", "computed", "value", "mappings" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5148-L5169
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(model) { if (!model) { this.__cache = {}; _.each(this.getTrackedModels(), function(model) { if (model) { this.__updateCache(model); } }, this); } else { this.__cache[model.cid] = this.__generateHashValue(model); } }
javascript
function(model) { if (!model) { this.__cache = {}; _.each(this.getTrackedModels(), function(model) { if (model) { this.__updateCache(model); } }, this); } else { this.__cache[model.cid] = this.__generateHashValue(model); } }
[ "function", "(", "model", ")", "{", "if", "(", "!", "model", ")", "{", "this", ".", "__cache", "=", "{", "}", ";", "_", ".", "each", "(", "this", ".", "getTrackedModels", "(", ")", ",", "function", "(", "model", ")", "{", "if", "(", "model", ")...
Updates the form model's snapshot of the model's attributes to use later @param model {Backbone.Model instance} the object model @param [cache=this.__cache] {Object} if passed an object (can be empty), this method will fill this cache object instead of this form model's __cache field @private @method __updateCache
[ "Updates", "the", "form", "model", "s", "snapshot", "of", "the", "model", "s", "attributes", "to", "use", "later" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5209-L5220
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(val) { var seed; if (_.isArray(val)) { seed = []; } else if (_.isObject(val)) { seed = {}; } else { return val; } return $.extend(true, seed, val); }
javascript
function(val) { var seed; if (_.isArray(val)) { seed = []; } else if (_.isObject(val)) { seed = {}; } else { return val; } return $.extend(true, seed, val); }
[ "function", "(", "val", ")", "{", "var", "seed", ";", "if", "(", "_", ".", "isArray", "(", "val", ")", ")", "{", "seed", "=", "[", "]", ";", "}", "else", "if", "(", "_", ".", "isObject", "(", "val", ")", ")", "{", "seed", "=", "{", "}", "...
Deep clones the attributes. There should be no functions in the attributes @param val {Object|Array|Basic Data Type} a non-function value @return the clone @private @method __cloneVal
[ "Deep", "clones", "the", "attributes", ".", "There", "should", "be", "no", "functions", "in", "the", "attributes" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5285-L5295
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(options) { var mapping, models, defaultMapping = _.result(this, 'mapping'), defaultModels = _.result(this, 'models'); mapping = options.mapping || defaultMapping; models = options.models || defaultModels; if (mapping) { this.setMappings(mapping, models); ...
javascript
function(options) { var mapping, models, defaultMapping = _.result(this, 'mapping'), defaultModels = _.result(this, 'models'); mapping = options.mapping || defaultMapping; models = options.models || defaultModels; if (mapping) { this.setMappings(mapping, models); ...
[ "function", "(", "options", ")", "{", "var", "mapping", ",", "models", ",", "defaultMapping", "=", "_", ".", "result", "(", "this", ",", "'mapping'", ")", ",", "defaultModels", "=", "_", ".", "result", "(", "this", ",", "'models'", ")", ";", "mapping",...
Sets the mapping using the form model's default mapping or the options.mappings if available. Also sets the tracked models if the form model's default models or the options.models is provided. @method __initMappings @param [options] {Object} See initialize options: 'mapping' and 'models'. @private
[ "Sets", "the", "mapping", "using", "the", "form", "model", "s", "default", "mapping", "or", "the", "options", ".", "mappings", "if", "available", ".", "Also", "sets", "the", "tracked", "models", "if", "the", "form", "model", "s", "default", "models", "or",...
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5365-L5375
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(model) { var allFields, fieldsUsed = {}, modelFields = {}, modelConfigs = []; _.each(this.__getAllModelConfigs(), function(modelConfig) { if (modelConfig.model && modelConfig.model.cid === model.cid) { modelConfigs.push(modelConfig); } }); ...
javascript
function(model) { var allFields, fieldsUsed = {}, modelFields = {}, modelConfigs = []; _.each(this.__getAllModelConfigs(), function(modelConfig) { if (modelConfig.model && modelConfig.model.cid === model.cid) { modelConfigs.push(modelConfig); } }); ...
[ "function", "(", "model", ")", "{", "var", "allFields", ",", "fieldsUsed", "=", "{", "}", ",", "modelFields", "=", "{", "}", ",", "modelConfigs", "=", "[", "]", ";", "_", ".", "each", "(", "this", ".", "__getAllModelConfigs", "(", ")", ",", "function...
Returns a map where the keys are the fields that are being tracked on tracked model and values are the with current values of those fields. @param model {Backbone.Model instance} the object model @return {Object} aa map where the keys are the fields that are being tracked on tracked model and values are the with curren...
[ "Returns", "a", "map", "where", "the", "keys", "are", "the", "fields", "that", "are", "being", "tracked", "on", "tracked", "model", "and", "values", "are", "the", "with", "current", "values", "of", "those", "fields", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5386-L5412
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(modelAlias, fields) { var model = this.getTrackedModel(modelAlias); if (model) { return { fields: fields, model: model }; } }
javascript
function(modelAlias, fields) { var model = this.getTrackedModel(modelAlias); if (model) { return { fields: fields, model: model }; } }
[ "function", "(", "modelAlias", ",", "fields", ")", "{", "var", "model", "=", "this", ".", "getTrackedModel", "(", "modelAlias", ")", ";", "if", "(", "model", ")", "{", "return", "{", "fields", ":", "fields", ",", "model", ":", "model", "}", ";", "}",...
Returns a useful data structure that binds a tracked model to the fields being tracked on a mapping. @method __createModelConfig @param modelAlias @param fields {Array of Strings or undefined} the fields that the model is tracking. Can be undefined if tracking all fields. When creating a model config for a computed map...
[ "Returns", "a", "useful", "data", "structure", "that", "binds", "a", "tracked", "model", "to", "the", "fields", "being", "tracked", "on", "a", "mapping", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5424-L5432
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var modelConfigs = []; _.each(this.getMappings(), function(config, alias) { if (config.computed) { var computedModelConfigs = this.__getComputedModelConfigs(alias); if (computedModelConfigs) { modelConfigs = modelConfigs.concat(computedModelConfigs); ...
javascript
function() { var modelConfigs = []; _.each(this.getMappings(), function(config, alias) { if (config.computed) { var computedModelConfigs = this.__getComputedModelConfigs(alias); if (computedModelConfigs) { modelConfigs = modelConfigs.concat(computedModelConfigs); ...
[ "function", "(", ")", "{", "var", "modelConfigs", "=", "[", "]", ";", "_", ".", "each", "(", "this", ".", "getMappings", "(", ")", ",", "function", "(", "config", ",", "alias", ")", "{", "if", "(", "config", ".", "computed", ")", "{", "var", "com...
Returns an array of convenience data structures that bind tracked models to the fields they are tracking for each mapping, including model mappings inside computed mappings. There will be a model config for each tracked model on a computed mapping meaning there can be multiple model configs for the same tracked model. ...
[ "Returns", "an", "array", "of", "convenience", "data", "structures", "that", "bind", "tracked", "models", "to", "the", "fields", "they", "are", "tracking", "for", "each", "mapping", "including", "model", "mappings", "inside", "computed", "mappings", ".", "There"...
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5443-L5459
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(args) { View.apply(this, arguments); args = args || {}; var collection = args.collection || this.collection; this.template = args.template || this.template; this.emptyTemplate = args.emptyTemplate || this.emptyTemplate; this.itemView = args.itemView || this.itemView; ...
javascript
function(args) { View.apply(this, arguments); args = args || {}; var collection = args.collection || this.collection; this.template = args.template || this.template; this.emptyTemplate = args.emptyTemplate || this.emptyTemplate; this.itemView = args.itemView || this.itemView; ...
[ "function", "(", "args", ")", "{", "View", ".", "apply", "(", "this", ",", "arguments", ")", ";", "args", "=", "args", "||", "{", "}", ";", "var", "collection", "=", "args", ".", "collection", "||", "this", ".", "collection", ";", "this", ".", "tem...
Constructor for the list view object. @method constructor @param args {Object} - options argument @param args.itemView {Backbone.View definition or Function} - the class definition of the item view. This view will be instantiated for every model returned by modelsToRender(). If a function is passed in, then for each mo...
[ "Constructor", "for", "the", "list", "view", "object", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5739-L5766
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(collection, preventUpdate) { this.stopListening(this.collection, 'remove', removeItemView); this.stopListening(this.collection, 'add', addItemView); this.stopListening(this.collection, 'sort', this.reorder); this.stopListening(this.collection, 'reset', this.update); this.collecti...
javascript
function(collection, preventUpdate) { this.stopListening(this.collection, 'remove', removeItemView); this.stopListening(this.collection, 'add', addItemView); this.stopListening(this.collection, 'sort', this.reorder); this.stopListening(this.collection, 'reset', this.update); this.collecti...
[ "function", "(", "collection", ",", "preventUpdate", ")", "{", "this", ".", "stopListening", "(", "this", ".", "collection", ",", "'remove'", ",", "removeItemView", ")", ";", "this", ".", "stopListening", "(", "this", ".", "collection", ",", "'add'", ",", ...
Sets the collection from which this view generates item views. This method will attach all necessary event listeners to the new collection to auto-generate item views and has the option of removing listeners on a previous collection. It will immediately update child views and re-render if it is necessary - this behavio...
[ "Sets", "the", "collection", "from", "which", "this", "view", "generates", "item", "views", ".", "This", "method", "will", "attach", "all", "necessary", "event", "listeners", "to", "the", "new", "collection", "to", "auto", "-", "generate", "item", "views", "...
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5778-L5794
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { _.each(this.modelsToRender(), function(model) { var itemView = this.getItemViewFromModel(model); if (itemView) { itemView.delegateEvents(); if (!itemView.__attachedCallbackInvoked && itemView.isAttached()) { itemView.__invokeAttached(); } ...
javascript
function() { _.each(this.modelsToRender(), function(model) { var itemView = this.getItemViewFromModel(model); if (itemView) { itemView.delegateEvents(); if (!itemView.__attachedCallbackInvoked && itemView.isAttached()) { itemView.__invokeAttached(); } ...
[ "function", "(", ")", "{", "_", ".", "each", "(", "this", ".", "modelsToRender", "(", ")", ",", "function", "(", "model", ")", "{", "var", "itemView", "=", "this", ".", "getItemViewFromModel", "(", "model", ")", ";", "if", "(", "itemView", ")", "{", ...
Completes each item view's lifecycle of being attached to a parent. Because the item views are attached in a non-standard way, it's important to make sure that the item views are in the appropriate state after being attached as one fragment. @method __cleanupItemViewsAfterAttachedToParent @private
[ "Completes", "each", "item", "view", "s", "lifecycle", "of", "being", "attached", "to", "a", "parent", ".", "Because", "the", "item", "views", "are", "attached", "in", "a", "non", "-", "standard", "way", "it", "s", "important", "to", "make", "sure", "tha...
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5826-L5839
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var oldViews = this.getItemViews(); var newViews = this.__createItemViews(); var staleViews = this.__getStaleItemViews(); var sizeOfOldViews = _.size(oldViews); var sizeOfNewViews = _.size(newViews); var sizeOfStaleViews = _.size(staleViews); var sizeOfFinalViews =...
javascript
function() { var oldViews = this.getItemViews(); var newViews = this.__createItemViews(); var staleViews = this.__getStaleItemViews(); var sizeOfOldViews = _.size(oldViews); var sizeOfNewViews = _.size(newViews); var sizeOfStaleViews = _.size(staleViews); var sizeOfFinalViews =...
[ "function", "(", ")", "{", "var", "oldViews", "=", "this", ".", "getItemViews", "(", ")", ";", "var", "newViews", "=", "this", ".", "__createItemViews", "(", ")", ";", "var", "staleViews", "=", "this", ".", "__getStaleItemViews", "(", ")", ";", "var", ...
Builds any new views, removes stale ones, and re-renders @method update
[ "Builds", "any", "new", "views", "removes", "stale", "ones", "and", "re", "-", "renders" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L5925-L5950
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(model, noUpdateToIdList) { var itemView, ItemViewClass = this.itemView; if (!_.isFunction(this.itemView.extend)) { ItemViewClass = this.itemView(model); } itemView = new ItemViewClass(this.__generateItemViewArgs(model)); this.registerTrackedView(itemView, { shared:...
javascript
function(model, noUpdateToIdList) { var itemView, ItemViewClass = this.itemView; if (!_.isFunction(this.itemView.extend)) { ItemViewClass = this.itemView(model); } itemView = new ItemViewClass(this.__generateItemViewArgs(model)); this.registerTrackedView(itemView, { shared:...
[ "function", "(", "model", ",", "noUpdateToIdList", ")", "{", "var", "itemView", ",", "ItemViewClass", "=", "this", ".", "itemView", ";", "if", "(", "!", "_", ".", "isFunction", "(", "this", ".", "itemView", ".", "extend", ")", ")", "{", "ItemViewClass", ...
Creates an item view and stores a reference to it @method __createItemView @private @param model {Backbone Model} the model to create the view from @param [noUpdateToIdList=false] if true, the internal order of model ids are not updated @return {Backbone View} the new item view
[ "Creates", "an", "item", "view", "and", "stores", "a", "reference", "to", "it" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6011-L6026
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var staleItemViews = []; var modelsWithViews = _.clone(this.__modelToViewMap); _.each(this.modelsToRender(), function(model) { var itemView = this.getItemViewFromModel(model); if (itemView) { delete modelsWithViews[model[this.__modelId]]; } }, this)...
javascript
function() { var staleItemViews = []; var modelsWithViews = _.clone(this.__modelToViewMap); _.each(this.modelsToRender(), function(model) { var itemView = this.getItemViewFromModel(model); if (itemView) { delete modelsWithViews[model[this.__modelId]]; } }, this)...
[ "function", "(", ")", "{", "var", "staleItemViews", "=", "[", "]", ";", "var", "modelsWithViews", "=", "_", ".", "clone", "(", "this", ".", "__modelToViewMap", ")", ";", "_", ".", "each", "(", "this", ".", "modelsToRender", "(", ")", ",", "function", ...
Gets all item views that have models that are no longer tracked by modelsToRender @method __getStaleItemViews @return {Array} An array of information about stale items. Each object has a 'view' and 'modelId' field @private
[ "Gets", "all", "item", "views", "that", "have", "models", "that", "are", "no", "longer", "tracked", "by", "modelsToRender" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6034-L6050
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(oldViews, newViews, staleViews) { var firstItemViewLeft, injectionSite, view = this, sizeOfOldViews = _.size(oldViews), sizeOfNewViews = _.size(newViews), sizeOfStaleViews = _.size(staleViews); if (view.itemContainer && sizeOfOldViews && sizeOfOldViews == sizeOfStale...
javascript
function(oldViews, newViews, staleViews) { var firstItemViewLeft, injectionSite, view = this, sizeOfOldViews = _.size(oldViews), sizeOfNewViews = _.size(newViews), sizeOfStaleViews = _.size(staleViews); if (view.itemContainer && sizeOfOldViews && sizeOfOldViews == sizeOfStale...
[ "function", "(", "oldViews", ",", "newViews", ",", "staleViews", ")", "{", "var", "firstItemViewLeft", ",", "injectionSite", ",", "view", "=", "this", ",", "sizeOfOldViews", "=", "_", ".", "size", "(", "oldViews", ")", ",", "sizeOfNewViews", "=", "_", ".",...
Attempts to insert new views and remove stale views individually and correctly reorder all views in an attempt to be faster then a full view re-render @method __updateByAddingRemoving @param oldViews {Array of Views} - correctly ordered list of views before making changes to models to render @param newViews {Array of V...
[ "Attempts", "to", "insert", "new", "views", "and", "remove", "stale", "views", "individually", "and", "correctly", "reorder", "all", "views", "in", "an", "attempt", "to", "be", "faster", "then", "a", "full", "view", "re", "-", "render" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6109-L6150
train
vecnatechnologies/backbone-torso
torso-bundle.js
normalizeIds
function normalizeIds(ids) { if (_.isArray(ids)) { // remove any nesting of arrays - it is assumed that the resulting ids will be simple string or number values. ids = _.flatten(ids); // remove any duplicate ids. return _.uniq(ids); } else if (_.isString(ids) || _.isNumber(ids)) { ...
javascript
function normalizeIds(ids) { if (_.isArray(ids)) { // remove any nesting of arrays - it is assumed that the resulting ids will be simple string or number values. ids = _.flatten(ids); // remove any duplicate ids. return _.uniq(ids); } else if (_.isString(ids) || _.isNumber(ids)) { ...
[ "function", "normalizeIds", "(", "ids", ")", "{", "if", "(", "_", ".", "isArray", "(", "ids", ")", ")", "{", "// remove any nesting of arrays - it is assumed that the resulting ids will be simple string or number values.", "ids", "=", "_", ".", "flatten", "(", "ids", ...
Converts string or number values into an array with a single string or number item. If the input is not a string, number, array, or info about the ids then undefined is returned. This is a private helper method used internally by this behavior and is not exposed in any way. @param ids {String|Number|String[]|Number[]|O...
[ "Converts", "string", "or", "number", "values", "into", "an", "array", "with", "a", "single", "string", "or", "number", "item", ".", "If", "the", "input", "is", "not", "a", "string", "number", "array", "or", "info", "about", "the", "ids", "then", "undefi...
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6247-L6259
train
vecnatechnologies/backbone-torso
torso-bundle.js
undefinedOrNullToEmptyArray
function undefinedOrNullToEmptyArray(valueToConvert) { if (_.isUndefined(valueToConvert) || _.isNull(valueToConvert)) { valueToConvert = []; } return valueToConvert; }
javascript
function undefinedOrNullToEmptyArray(valueToConvert) { if (_.isUndefined(valueToConvert) || _.isNull(valueToConvert)) { valueToConvert = []; } return valueToConvert; }
[ "function", "undefinedOrNullToEmptyArray", "(", "valueToConvert", ")", "{", "if", "(", "_", ".", "isUndefined", "(", "valueToConvert", ")", "||", "_", ".", "isNull", "(", "valueToConvert", ")", ")", "{", "valueToConvert", "=", "[", "]", ";", "}", "return", ...
Converts any undefined or null values to an empty array. All other values are left unchanged. @param valueToConvert the value to check for null or undefined. @return {Array|*} either the original value or [] if the valueToConvert is null or undefined.
[ "Converts", "any", "undefined", "or", "null", "values", "to", "an", "empty", "array", ".", "All", "other", "values", "are", "left", "unchanged", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6266-L6271
train
vecnatechnologies/backbone-torso
torso-bundle.js
getNestedProperty
function getNestedProperty(rootObject, propertyString) { propertyString = propertyString.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties propertyString = propertyString.replace(/^\./, ''); // strip a leading dot var propertyStringParts = propertyString.split(PROPERTY_SEPARATOR); ...
javascript
function getNestedProperty(rootObject, propertyString) { propertyString = propertyString.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties propertyString = propertyString.replace(/^\./, ''); // strip a leading dot var propertyStringParts = propertyString.split(PROPERTY_SEPARATOR); ...
[ "function", "getNestedProperty", "(", "rootObject", ",", "propertyString", ")", "{", "propertyString", "=", "propertyString", ".", "replace", "(", "/", "\\[(\\w+)\\]", "/", "g", ",", "'.$1'", ")", ";", "// convert indexes to properties", "propertyString", "=", "prop...
Gets a nested property from an object, returning undefined if it doesn't exist on any level. @param rootObject {Object} object containing the property to get. @param propertyString {String} string identifying the nested object to retrieve. @return {*} either undefined or the property referenced from the rootObject.
[ "Gets", "a", "nested", "property", "from", "an", "object", "returning", "undefined", "if", "it", "doesn", "t", "exist", "on", "any", "level", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6279-L6286
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var behaviorContext = Behavior.prototype.prepare.apply(this) || {}; behaviorContext.data = this.data.toJSON(); behaviorContext.loading = this.isLoading(); behaviorContext.loadingIds = this.isLoadingIds(); behaviorContext.loadingObjects = this.isLoadingObjects(); return b...
javascript
function() { var behaviorContext = Behavior.prototype.prepare.apply(this) || {}; behaviorContext.data = this.data.toJSON(); behaviorContext.loading = this.isLoading(); behaviorContext.loadingIds = this.isLoadingIds(); behaviorContext.loadingObjects = this.isLoadingObjects(); return b...
[ "function", "(", ")", "{", "var", "behaviorContext", "=", "Behavior", ".", "prototype", ".", "prepare", ".", "apply", "(", "this", ")", "||", "{", "}", ";", "behaviorContext", ".", "data", "=", "this", ".", "data", ".", "toJSON", "(", ")", ";", "beha...
Adds the toJSON of the data represented by this behavior to the context. @method prepare @override
[ "Adds", "the", "toJSON", "of", "the", "data", "represented", "by", "this", "behavior", "to", "the", "context", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6553-L6560
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { if (!_.isUndefined(this.ids.property)) { this.stopListeningToIdsPropertyChangeEvent(); var idsPropertyNameAndContext = this.__parseIdsPropertyNameAndIdContainer(); var idContainer = idsPropertyNameAndContext.idContainer; var canListenToEvents = idContainer && _.isFunct...
javascript
function() { if (!_.isUndefined(this.ids.property)) { this.stopListeningToIdsPropertyChangeEvent(); var idsPropertyNameAndContext = this.__parseIdsPropertyNameAndIdContainer(); var idContainer = idsPropertyNameAndContext.idContainer; var canListenToEvents = idContainer && _.isFunct...
[ "function", "(", ")", "{", "if", "(", "!", "_", ".", "isUndefined", "(", "this", ".", "ids", ".", "property", ")", ")", "{", "this", ".", "stopListeningToIdsPropertyChangeEvent", "(", ")", ";", "var", "idsPropertyNameAndContext", "=", "this", ".", "__parse...
Listens for the change event on the ids property and, if triggered, re-fetches the data based on the new ids. @method listenToIdsPropertyChangeEvent
[ "Listens", "for", "the", "change", "event", "on", "the", "ids", "property", "and", "if", "triggered", "re", "-", "fetches", "the", "data", "based", "on", "the", "new", "ids", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6596-L6609
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { this._undelegateUpdateEvents(); var updateEvents = this.__parseUpdateEvents(); _.each(updateEvents, function(parsedUpdateEvent) { this.listenTo(parsedUpdateEvent.idContainer, parsedUpdateEvent.eventName, this.retrieve); }, this); }
javascript
function() { this._undelegateUpdateEvents(); var updateEvents = this.__parseUpdateEvents(); _.each(updateEvents, function(parsedUpdateEvent) { this.listenTo(parsedUpdateEvent.idContainer, parsedUpdateEvent.eventName, this.retrieve); }, this); }
[ "function", "(", ")", "{", "this", ".", "_undelegateUpdateEvents", "(", ")", ";", "var", "updateEvents", "=", "this", ".", "__parseUpdateEvents", "(", ")", ";", "_", ".", "each", "(", "updateEvents", ",", "function", "(", "parsedUpdateEvent", ")", "{", "th...
Removes existing listeners and adds new ones for all of the updateEvents configured. @method _delegateUpdateEvents @private
[ "Removes", "existing", "listeners", "and", "adds", "new", "ones", "for", "all", "of", "the", "updateEvents", "configured", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6669-L6675
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var updateEvents = this.__parseUpdateEvents(); _.each(updateEvents, function(parsedUpdateEvent) { this.stopListening(parsedUpdateEvent.idContainer, parsedUpdateEvent.eventName, this.retrieve); }, this); }
javascript
function() { var updateEvents = this.__parseUpdateEvents(); _.each(updateEvents, function(parsedUpdateEvent) { this.stopListening(parsedUpdateEvent.idContainer, parsedUpdateEvent.eventName, this.retrieve); }, this); }
[ "function", "(", ")", "{", "var", "updateEvents", "=", "this", ".", "__parseUpdateEvents", "(", ")", ";", "_", ".", "each", "(", "updateEvents", ",", "function", "(", "parsedUpdateEvent", ")", "{", "this", ".", "stopListening", "(", "parsedUpdateEvent", ".",...
Removes existing event listeners. @method _undelegateEvents @private
[ "Removes", "existing", "event", "listeners", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6682-L6687
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { this.__normalizeAndValidateUpdateEvents(); var updateEvents = _.flatten(_.map(this.updateEvents, this.__parseUpdateEvent, this)); return _.compact(updateEvents); }
javascript
function() { this.__normalizeAndValidateUpdateEvents(); var updateEvents = _.flatten(_.map(this.updateEvents, this.__parseUpdateEvent, this)); return _.compact(updateEvents); }
[ "function", "(", ")", "{", "this", ".", "__normalizeAndValidateUpdateEvents", "(", ")", ";", "var", "updateEvents", "=", "_", ".", "flatten", "(", "_", ".", "map", "(", "this", ".", "updateEvents", ",", "this", ".", "__parseUpdateEvent", ",", "this", ")", ...
Parses this.updateEvents configuration. @return {[{ eventName: String, idContainer: Object }]} an array of objects with the event name and idContainer included. @private
[ "Parses", "this", ".", "updateEvents", "configuration", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6694-L6698
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var updateEventsIsArray = _.isArray(this.updateEvents); var updateEventsIsSingleValue = !updateEventsIsArray && (_.isObject(this.updateEvents) || _.isString(this.updateEvents)); var updateEventsIsUndefined = _.isUndefined(this.updateEvents); var updateEventsIsValidType = updateEvent...
javascript
function() { var updateEventsIsArray = _.isArray(this.updateEvents); var updateEventsIsSingleValue = !updateEventsIsArray && (_.isObject(this.updateEvents) || _.isString(this.updateEvents)); var updateEventsIsUndefined = _.isUndefined(this.updateEvents); var updateEventsIsValidType = updateEvent...
[ "function", "(", ")", "{", "var", "updateEventsIsArray", "=", "_", ".", "isArray", "(", "this", ".", "updateEvents", ")", ";", "var", "updateEventsIsSingleValue", "=", "!", "updateEventsIsArray", "&&", "(", "_", ".", "isObject", "(", "this", ".", "updateEven...
Validates that the updateEvents property is valid and if not throws an error describing why its not valid. @method __normalizeAndValidateUpdateEvents @private
[ "Validates", "that", "the", "updateEvents", "property", "is", "valid", "and", "if", "not", "throws", "an", "error", "describing", "why", "its", "not", "valid", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6797-L6814
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(updateEventConfiguration) { var validStringConfig = _.isString(updateEventConfiguration); var validObjectConfig = _.isObject(updateEventConfiguration) && _.keys(updateEventConfiguration).length > 0; if (!validStringConfig && !validObjectConfig) { throw new Error('Not a valid updateEve...
javascript
function(updateEventConfiguration) { var validStringConfig = _.isString(updateEventConfiguration); var validObjectConfig = _.isObject(updateEventConfiguration) && _.keys(updateEventConfiguration).length > 0; if (!validStringConfig && !validObjectConfig) { throw new Error('Not a valid updateEve...
[ "function", "(", "updateEventConfiguration", ")", "{", "var", "validStringConfig", "=", "_", ".", "isString", "(", "updateEventConfiguration", ")", ";", "var", "validObjectConfig", "=", "_", ".", "isObject", "(", "updateEventConfiguration", ")", "&&", "_", ".", ...
Validates that the updateEventConfiguration is valid and if not throws an error describing why its not valid. @method __normalizeAndValidateIds @private
[ "Validates", "that", "the", "updateEventConfiguration", "is", "valid", "and", "if", "not", "throws", "an", "error", "describing", "why", "its", "not", "valid", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6821-L6827
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var propertyName = this.ids.property; var propertyNameContainsIdContainer = containsContainerDefinition(propertyName); var hasIdContainerProperty = !_.isUndefined(this.ids.idContainer); var idContainer; if (hasIdContainerProperty) { idContainer = this.__parseIdContain...
javascript
function() { var propertyName = this.ids.property; var propertyNameContainsIdContainer = containsContainerDefinition(propertyName); var hasIdContainerProperty = !_.isUndefined(this.ids.idContainer); var idContainer; if (hasIdContainerProperty) { idContainer = this.__parseIdContain...
[ "function", "(", ")", "{", "var", "propertyName", "=", "this", ".", "ids", ".", "property", ";", "var", "propertyNameContainsIdContainer", "=", "containsContainerDefinition", "(", "propertyName", ")", ";", "var", "hasIdContainerProperty", "=", "!", "_", ".", "is...
Converts the definition into the actual idContainer object and property name to retrieve off of that idContainer. @method __parseIdsPropertyNameAndIdContainer @return {{idsPropertyName: String, idContainer: Object}} the name of the ids property and the actual object to use as the idContainer. @private
[ "Converts", "the", "definition", "into", "the", "actual", "idContainer", "object", "and", "property", "name", "to", "retrieve", "off", "of", "that", "idContainer", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6891-L6915
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var idContainerDefinition = this.ids.idContainer; var idContainer; if (_.isUndefined(idContainerDefinition)) { idContainer = undefined; } else if (_.isFunction(idContainerDefinition)) { var idContainerFxn = _.bind(idContainerDefinition, this); idContainer = i...
javascript
function() { var idContainerDefinition = this.ids.idContainer; var idContainer; if (_.isUndefined(idContainerDefinition)) { idContainer = undefined; } else if (_.isFunction(idContainerDefinition)) { var idContainerFxn = _.bind(idContainerDefinition, this); idContainer = i...
[ "function", "(", ")", "{", "var", "idContainerDefinition", "=", "this", ".", "ids", ".", "idContainer", ";", "var", "idContainer", ";", "if", "(", "_", ".", "isUndefined", "(", "idContainerDefinition", ")", ")", "{", "idContainer", "=", "undefined", ";", "...
Parses the idContainer property of ids. @return {Object} the idContainer object to apply the properties value to (may not be the final idContainer depending on the property definition). @private
[ "Parses", "the", "idContainer", "property", "of", "ids", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L6922-L6936
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var resultDeferred = $.Deferred(); if (this.isDisposed()) { var rejectArguments = Array.prototype.slice.call(arguments); rejectArguments.push('Data Behavior disposed, aborting.'); resultDeferred.reject.apply(resultDeferred, rejectArguments); } else { result...
javascript
function() { var resultDeferred = $.Deferred(); if (this.isDisposed()) { var rejectArguments = Array.prototype.slice.call(arguments); rejectArguments.push('Data Behavior disposed, aborting.'); resultDeferred.reject.apply(resultDeferred, rejectArguments); } else { result...
[ "function", "(", ")", "{", "var", "resultDeferred", "=", "$", ".", "Deferred", "(", ")", ";", "if", "(", "this", ".", "isDisposed", "(", ")", ")", "{", "var", "rejectArguments", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "argumen...
Rejects the promise chain if this behavior is already disposed. @return {jQuery.Promise} that is resolved if the behavior is not disposed and rejects if the behavior is disposed. @private
[ "Rejects", "the", "promise", "chain", "if", "this", "behavior", "is", "already", "disposed", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L7012-L7022
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(idsResult) { if (_.isEmpty(idsResult) && _.isEmpty(this.data.privateCollection.getTrackedIds())) { return { skipObjectRetrieval: true, forceFetchedEvent: true }; } else { return idsResult; } }
javascript
function(idsResult) { if (_.isEmpty(idsResult) && _.isEmpty(this.data.privateCollection.getTrackedIds())) { return { skipObjectRetrieval: true, forceFetchedEvent: true }; } else { return idsResult; } }
[ "function", "(", "idsResult", ")", "{", "if", "(", "_", ".", "isEmpty", "(", "idsResult", ")", "&&", "_", ".", "isEmpty", "(", "this", ".", "data", ".", "privateCollection", ".", "getTrackedIds", "(", ")", ")", ")", "{", "return", "{", "skipObjectRetri...
Skip retrieving objects if new ids list is empty and existing ids list is empty. @method __skipRetrieveOnEmptyTrackedIdsAndNewIds @param idsResult {Array|Object} @return {Array|Object} either the original idsResult or { skipObjectRetrieval: true, forceFetchedEvent: true } if both the ids retrieved and the current ids a...
[ "Skip", "retrieving", "objects", "if", "new", "ids", "list", "is", "empty", "and", "existing", "ids", "list", "is", "empty", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L7101-L7107
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var privateCollection = this.privateCollection; if (!this.parentBehavior.returnSingleResult) { return privateCollection.toJSON(); } if (privateCollection.length === 0) { return undefined; } else if (privateCollection.length === 1) { var singleResultMod...
javascript
function() { var privateCollection = this.privateCollection; if (!this.parentBehavior.returnSingleResult) { return privateCollection.toJSON(); } if (privateCollection.length === 0) { return undefined; } else if (privateCollection.length === 1) { var singleResultMod...
[ "function", "(", ")", "{", "var", "privateCollection", "=", "this", ".", "privateCollection", ";", "if", "(", "!", "this", ".", "parentBehavior", ".", "returnSingleResult", ")", "{", "return", "privateCollection", ".", "toJSON", "(", ")", ";", "}", "if", "...
Get the full data object contents. Either an array if returnSingleResult is false or a single object if it is true. @method toJSON @return {Object|Object[]} containing the full contents of either the collection or model.
[ "Get", "the", "full", "data", "object", "contents", ".", "Either", "an", "array", "if", "returnSingleResult", "is", "false", "or", "a", "single", "object", "if", "it", "is", "true", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L7203-L7217
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(args) { args = args || {}; /* Listen to model validation callbacks */ var FormModelClass = args.FormModelClass || this.FormModelClass || FormModel; this.model = args.model || this.model || (new FormModelClass()); /* Override template */ this.template = args.template || thi...
javascript
function(args) { args = args || {}; /* Listen to model validation callbacks */ var FormModelClass = args.FormModelClass || this.FormModelClass || FormModel; this.model = args.model || this.model || (new FormModelClass()); /* Override template */ this.template = args.template || thi...
[ "function", "(", "args", ")", "{", "args", "=", "args", "||", "{", "}", ";", "/* Listen to model validation callbacks */", "var", "FormModelClass", "=", "args", ".", "FormModelClass", "||", "this", ".", "FormModelClass", "||", "FormModel", ";", "this", ".", "m...
Validation error hash @private @property _errors @type Object Validation success @private @property _success @type Boolean Stickit bindings hash local backup @private @property _bindings @type Object Handlebars template for form @property template @type HTMLtemplate Backbone events hash @property events @type O...
[ "Validation", "error", "hash" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L7394-L7415
train
vecnatechnologies/backbone-torso
torso-bundle.js
function() { var templateContext = View.prototype.prepare.apply(this); templateContext.formErrors = (_.size(this._errors) !== 0) ? this._errors : null; templateContext.formSuccess = this._success; return templateContext; }
javascript
function() { var templateContext = View.prototype.prepare.apply(this); templateContext.formErrors = (_.size(this._errors) !== 0) ? this._errors : null; templateContext.formSuccess = this._success; return templateContext; }
[ "function", "(", ")", "{", "var", "templateContext", "=", "View", ".", "prototype", ".", "prepare", ".", "apply", "(", "this", ")", ";", "templateContext", ".", "formErrors", "=", "(", "_", ".", "size", "(", "this", ".", "_errors", ")", "!==", "0", "...
Prepare the formview's default render context @method prepare @return {Object} {Object.errors} A hash of field names mapped to error messages {Object.success} A boolean value of true if validation has succeeded
[ "Prepare", "the", "formview", "s", "default", "render", "context" ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L7424-L7429
train
vecnatechnologies/backbone-torso
torso-bundle.js
function(model, stopListening) { if (this.model && stopListening) { this.stopListening(this.model); } this.model = model; this.listenTo(this.model, 'validated:valid', this.valid); this.listenTo(this.model, 'validated:invalid', this.invalid); }
javascript
function(model, stopListening) { if (this.model && stopListening) { this.stopListening(this.model); } this.model = model; this.listenTo(this.model, 'validated:valid', this.valid); this.listenTo(this.model, 'validated:invalid', this.invalid); }
[ "function", "(", "model", ",", "stopListening", ")", "{", "if", "(", "this", ".", "model", "&&", "stopListening", ")", "{", "this", ".", "stopListening", "(", "this", ".", "model", ")", ";", "}", "this", ".", "model", "=", "model", ";", "this", ".", ...
Resets the form model with the passed in model. Stops listening to current form model and sets up listeners on the new one. @method resetModelListeners @param model {Torso.FormModel} the new form model @param [stopListening=false] {Boolean} if true, it will stop listening to the previous form model
[ "Resets", "the", "form", "model", "with", "the", "passed", "in", "model", ".", "Stops", "listening", "to", "current", "form", "model", "and", "sets", "up", "listeners", "on", "the", "new", "one", "." ]
5afd50da74bd46517dca75d23c10fea594730be2
https://github.com/vecnatechnologies/backbone-torso/blob/5afd50da74bd46517dca75d23c10fea594730be2/torso-bundle.js#L7449-L7456
train
pebble/clay
src/scripts/components/color.js
deltaE
function deltaE(labA, labB) { var deltaL = labA[0] - labB[0]; var deltaA = labA[1] - labB[1]; var deltaB = labA[2] - labB[2]; return Math.sqrt(Math.pow(deltaL, 2) + Math.pow(deltaA, 2) + Math.pow(deltaB, 2)); }
javascript
function deltaE(labA, labB) { var deltaL = labA[0] - labB[0]; var deltaA = labA[1] - labB[1]; var deltaB = labA[2] - labB[2]; return Math.sqrt(Math.pow(deltaL, 2) + Math.pow(deltaA, 2) + Math.pow(deltaB, 2)); }
[ "function", "deltaE", "(", "labA", ",", "labB", ")", "{", "var", "deltaL", "=", "labA", "[", "0", "]", "-", "labB", "[", "0", "]", ";", "var", "deltaA", "=", "labA", "[", "1", "]", "-", "labB", "[", "1", "]", ";", "var", "deltaB", "=", "labA"...
Find the perceptual color distance between two LAB colors @param {Array} labA @param {Array} labB @returns {number}
[ "Find", "the", "perceptual", "color", "distance", "between", "two", "LAB", "colors" ]
1bf6db08092ab464974d1762a953ea7cbd24efb8
https://github.com/pebble/clay/blob/1bf6db08092ab464974d1762a953ea7cbd24efb8/src/scripts/components/color.js#L102-L110
train
pebble/clay
src/scripts/components/color.js
autoLayout
function autoLayout() { if (!clay.meta.activeWatchInfo || clay.meta.activeWatchInfo.firmware.major === 2 || ['aplite', 'diorite'].indexOf(clay.meta.activeWatchInfo.platform) > -1 && !self.config.allowGray) { return standardLayouts.BLACK_WHITE; } if (['aplite', 'd...
javascript
function autoLayout() { if (!clay.meta.activeWatchInfo || clay.meta.activeWatchInfo.firmware.major === 2 || ['aplite', 'diorite'].indexOf(clay.meta.activeWatchInfo.platform) > -1 && !self.config.allowGray) { return standardLayouts.BLACK_WHITE; } if (['aplite', 'd...
[ "function", "autoLayout", "(", ")", "{", "if", "(", "!", "clay", ".", "meta", ".", "activeWatchInfo", "||", "clay", ".", "meta", ".", "activeWatchInfo", ".", "firmware", ".", "major", "===", "2", "||", "[", "'aplite'", ",", "'diorite'", "]", ".", "inde...
Returns the layout based on the connected watch @returns {Array}
[ "Returns", "the", "layout", "based", "on", "the", "connected", "watch" ]
1bf6db08092ab464974d1762a953ea7cbd24efb8
https://github.com/pebble/clay/blob/1bf6db08092ab464974d1762a953ea7cbd24efb8/src/scripts/components/color.js#L116-L130
train
tmcw/stickshift
lib/vega.js
sources
function sources(k) { (src[k] || []).forEach(function(s) { deps[s] = k; sources(s); }); }
javascript
function sources(k) { (src[k] || []).forEach(function(s) { deps[s] = k; sources(s); }); }
[ "function", "sources", "(", "k", ")", "{", "(", "src", "[", "k", "]", "||", "[", "]", ")", ".", "forEach", "(", "function", "(", "s", ")", "{", "deps", "[", "s", "]", "=", "k", ";", "sources", "(", "s", ")", ";", "}", ")", ";", "}" ]
collect source data set dependencies
[ "collect", "source", "data", "set", "dependencies" ]
1be06709ca2e1c59d5e5d4b9a0c7b34a46349001
https://github.com/tmcw/stickshift/blob/1be06709ca2e1c59d5e5d4b9a0c7b34a46349001/lib/vega.js#L6880-L6882
train
zurb/supercollider
bin/supercollider.js
lib
function lib(val) { var p = path.join(process.cwd(), val); return require(p); }
javascript
function lib(val) { var p = path.join(process.cwd(), val); return require(p); }
[ "function", "lib", "(", "val", ")", "{", "var", "p", "=", "path", ".", "join", "(", "process", ".", "cwd", "(", ")", ",", "val", ")", ";", "return", "require", "(", "p", ")", ";", "}" ]
Returns a require'd library from a path
[ "Returns", "a", "require", "d", "library", "from", "a", "path" ]
83cdb9a0e652b448895394d6c83c33b88f44fad2
https://github.com/zurb/supercollider/blob/83cdb9a0e652b448895394d6c83c33b88f44fad2/bin/supercollider.js#L38-L41
train
darul75/ng-prettyjson
src/ng-prettyjson.js
highlight
function highlight(value) { var html = ngPrettyJsonFunctions.syntaxHighlight(value) || ""; html = html .replace(/\{/g, "<span class='sep'>{</span>") .replace(/\}/g, "<span class='sep'>}</span>") .replace(/\[/g, "<span class='sep'>[</span>") .replace(/\]/g, "<span class='s...
javascript
function highlight(value) { var html = ngPrettyJsonFunctions.syntaxHighlight(value) || ""; html = html .replace(/\{/g, "<span class='sep'>{</span>") .replace(/\}/g, "<span class='sep'>}</span>") .replace(/\[/g, "<span class='sep'>[</span>") .replace(/\]/g, "<span class='s...
[ "function", "highlight", "(", "value", ")", "{", "var", "html", "=", "ngPrettyJsonFunctions", ".", "syntaxHighlight", "(", "value", ")", "||", "\"\"", ";", "html", "=", "html", ".", "replace", "(", "/", "\\{", "/", "g", ",", "\"<span class='sep'>{</span>\"",...
prefer the "json" attribute over the "prettyJson" one. the value on the scope might not be defined yet, so look at the markup.
[ "prefer", "the", "json", "attribute", "over", "the", "prettyJson", "one", ".", "the", "value", "on", "the", "scope", "might", "not", "be", "defined", "yet", "so", "look", "at", "the", "markup", "." ]
2af9bae4d4e9021b5d22e09ffff593b3f5b25f5a
https://github.com/darul75/ng-prettyjson/blob/2af9bae4d4e9021b5d22e09ffff593b3f5b25f5a/src/ng-prettyjson.js#L45-L54
train
pebble/clay
index.js
_populateMeta
function _populateMeta() { self.meta = { activeWatchInfo: Pebble.getActiveWatchInfo && Pebble.getActiveWatchInfo(), accountToken: Pebble.getAccountToken(), watchToken: Pebble.getWatchToken(), userData: deepcopy(options.userData || {}) }; }
javascript
function _populateMeta() { self.meta = { activeWatchInfo: Pebble.getActiveWatchInfo && Pebble.getActiveWatchInfo(), accountToken: Pebble.getAccountToken(), watchToken: Pebble.getWatchToken(), userData: deepcopy(options.userData || {}) }; }
[ "function", "_populateMeta", "(", ")", "{", "self", ".", "meta", "=", "{", "activeWatchInfo", ":", "Pebble", ".", "getActiveWatchInfo", "&&", "Pebble", ".", "getActiveWatchInfo", "(", ")", ",", "accountToken", ":", "Pebble", ".", "getAccountToken", "(", ")", ...
Populate the meta with data from the Pebble object. Make sure to run this inside either the "showConfiguration" or "ready" event handler @return {void}
[ "Populate", "the", "meta", "with", "data", "from", "the", "Pebble", "object", ".", "Make", "sure", "to", "run", "this", "inside", "either", "the", "showConfiguration", "or", "ready", "event", "handler" ]
1bf6db08092ab464974d1762a953ea7cbd24efb8
https://github.com/pebble/clay/blob/1bf6db08092ab464974d1762a953ea7cbd24efb8/index.js#L50-L57
train
HuddleEng/PhantomXHR
CasperJs/bin/bootstrap.js
initCasperCli
function initCasperCli(casperArgs) { var baseTestsPath = fs.pathJoin(phantom.casperPath, 'tests'); if (!!casperArgs.options.version) { return __terminate(phantom.casperVersion.toString()) } else if (casperArgs.get(0) === "test") { phantom.casperScript = fs.absolute(fs.pa...
javascript
function initCasperCli(casperArgs) { var baseTestsPath = fs.pathJoin(phantom.casperPath, 'tests'); if (!!casperArgs.options.version) { return __terminate(phantom.casperVersion.toString()) } else if (casperArgs.get(0) === "test") { phantom.casperScript = fs.absolute(fs.pa...
[ "function", "initCasperCli", "(", "casperArgs", ")", "{", "var", "baseTestsPath", "=", "fs", ".", "pathJoin", "(", "phantom", ".", "casperPath", ",", "'tests'", ")", ";", "if", "(", "!", "!", "casperArgs", ".", "options", ".", "version", ")", "{", "retur...
Initializes the CasperJS Command Line Interface.
[ "Initializes", "the", "CasperJS", "Command", "Line", "Interface", "." ]
0584a060ca0b6370eae448eda416a66b4ffc6eb6
https://github.com/HuddleEng/PhantomXHR/blob/0584a060ca0b6370eae448eda416a66b4ffc6eb6/CasperJs/bin/bootstrap.js#L227-L268
train
pebble/clay
src/scripts/components/slider.js
setValueDisplay
function setValueDisplay() { var value = self.get().toFixed(self.precision); $value.set('value', value); $valuePad.set('innerHTML', value); }
javascript
function setValueDisplay() { var value = self.get().toFixed(self.precision); $value.set('value', value); $valuePad.set('innerHTML', value); }
[ "function", "setValueDisplay", "(", ")", "{", "var", "value", "=", "self", ".", "get", "(", ")", ".", "toFixed", "(", "self", ".", "precision", ")", ";", "$value", ".", "set", "(", "'value'", ",", "value", ")", ";", "$valuePad", ".", "set", "(", "'...
Sets the value display @return {void}
[ "Sets", "the", "value", "display" ]
1bf6db08092ab464974d1762a953ea7cbd24efb8
https://github.com/pebble/clay/blob/1bf6db08092ab464974d1762a953ea7cbd24efb8/src/scripts/components/slider.js#L27-L31
train
zurb/supercollider
lib/buildSearch.js
keysInObject
function keysInObject(obj, keys) { for (var i in keys) { if (keys[i] in obj) return true; } return false; }
javascript
function keysInObject(obj, keys) { for (var i in keys) { if (keys[i] in obj) return true; } return false; }
[ "function", "keysInObject", "(", "obj", ",", "keys", ")", "{", "for", "(", "var", "i", "in", "keys", ")", "{", "if", "(", "keys", "[", "i", "]", "in", "obj", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
Determines if any key in an array exists on an object. @param {object} obj - Object to check for keys. @param {array} keys - Keys to check. @returns {boolean} `true` if any key is found on the object, or `false` if not.
[ "Determines", "if", "any", "key", "in", "an", "array", "exists", "on", "an", "object", "." ]
83cdb9a0e652b448895394d6c83c33b88f44fad2
https://github.com/zurb/supercollider/blob/83cdb9a0e652b448895394d6c83c33b88f44fad2/lib/buildSearch.js#L72-L77
train
pebble/clay
src/scripts/components/select.js
setValueDisplay
function setValueDisplay() { var selectedIndex = self.$manipulatorTarget.get('selectedIndex'); var $options = self.$manipulatorTarget.select('option'); var value = $options[selectedIndex] && $options[selectedIndex].innerHTML; $value.set('innerHTML', value); }
javascript
function setValueDisplay() { var selectedIndex = self.$manipulatorTarget.get('selectedIndex'); var $options = self.$manipulatorTarget.select('option'); var value = $options[selectedIndex] && $options[selectedIndex].innerHTML; $value.set('innerHTML', value); }
[ "function", "setValueDisplay", "(", ")", "{", "var", "selectedIndex", "=", "self", ".", "$manipulatorTarget", ".", "get", "(", "'selectedIndex'", ")", ";", "var", "$options", "=", "self", ".", "$manipulatorTarget", ".", "select", "(", "'option'", ")", ";", "...
Updates the HTML value of the component to match the slected option's label @return {void}
[ "Updates", "the", "HTML", "value", "of", "the", "component", "to", "match", "the", "slected", "option", "s", "label" ]
1bf6db08092ab464974d1762a953ea7cbd24efb8
https://github.com/pebble/clay/blob/1bf6db08092ab464974d1762a953ea7cbd24efb8/src/scripts/components/select.js#L23-L28
train
refractproject/minim
lib/ArraySlice.js
coerceElementMatchingCallback
function coerceElementMatchingCallback(value) { // Element Name if (typeof value === 'string') { return element => element.element === value; } // Element Type if (value.constructor && value.extend) { return element => element instanceof value; } return value; }
javascript
function coerceElementMatchingCallback(value) { // Element Name if (typeof value === 'string') { return element => element.element === value; } // Element Type if (value.constructor && value.extend) { return element => element instanceof value; } return value; }
[ "function", "coerceElementMatchingCallback", "(", "value", ")", "{", "// Element Name", "if", "(", "typeof", "value", "===", "'string'", ")", "{", "return", "element", "=>", "element", ".", "element", "===", "value", ";", "}", "// Element Type", "if", "(", "va...
Coerces an a parameter into a callback for matching elements. This accepts an element name, an element type and returns a callback to match for those elements.
[ "Coerces", "an", "a", "parameter", "into", "a", "callback", "for", "matching", "elements", ".", "This", "accepts", "an", "element", "name", "an", "element", "type", "and", "returns", "a", "callback", "to", "match", "for", "those", "elements", "." ]
7945b8b5e27c5f35e2e5301930c8269edbc284c2
https://github.com/refractproject/minim/blob/7945b8b5e27c5f35e2e5301930c8269edbc284c2/lib/ArraySlice.js#L6-L18
train
AckerApple/ack-angular-fx
bin/src/animations/helper.js
inFromVoid
function inFromVoid(from, to) { return to !== null && to !== 'nofx' && from === 'void' && to !== 'void' ? true : false; }
javascript
function inFromVoid(from, to) { return to !== null && to !== 'nofx' && from === 'void' && to !== 'void' ? true : false; }
[ "function", "inFromVoid", "(", "from", ",", "to", ")", "{", "return", "to", "!==", "null", "&&", "to", "!==", "'nofx'", "&&", "from", "===", "'void'", "&&", "to", "!==", "'void'", "?", "true", ":", "false", ";", "}" ]
used for showing
[ "used", "for", "showing" ]
35308841b3d5a5736063a0cabdb414ced0522747
https://github.com/AckerApple/ack-angular-fx/blob/35308841b3d5a5736063a0cabdb414ced0522747/bin/src/animations/helper.js#L46-L48
train
soney/constraintjs
src/state_machine/cjs_events.js
function(event_type) { var rest_args = arguments.length > 1 ? rest(arguments) : root, // no parent, no filter by default event = new CJSEvent(false, false, function(transition) { var targets = [], timeout_id = false, event_type_val = [], listener = bind(this._fire, this), fsm = t...
javascript
function(event_type) { var rest_args = arguments.length > 1 ? rest(arguments) : root, // no parent, no filter by default event = new CJSEvent(false, false, function(transition) { var targets = [], timeout_id = false, event_type_val = [], listener = bind(this._fire, this), fsm = t...
[ "function", "(", "event_type", ")", "{", "var", "rest_args", "=", "arguments", ".", "length", ">", "1", "?", "rest", "(", "arguments", ")", ":", "root", ",", "// no parent, no filter by default", "event", "=", "new", "CJSEvent", "(", "false", ",", "false", ...
Create a new event for use in a finite state machine transition @constructs CJSEvent @method cjs.on @param {string} event_type - the type of event to listen for (e.g. mousedown, timeout) @param {element|number} ...targets=window - Any number of target objects to listen to @return {CJSEvent} - An event that can be atta...
[ "Create", "a", "new", "event", "for", "use", "in", "a", "finite", "state", "machine", "transition" ]
98a164063efc8d3b59a372b332c7a3e0a1292561
https://github.com/soney/constraintjs/blob/98a164063efc8d3b59a372b332c7a3e0a1292561/src/state_machine/cjs_events.js#L138-L209
train
soney/constraintjs
src/memoize.js
function () { var args = slice.call(arguments), constraint = options.args_map.getOrPut(args, function() { return new Constraint(function () { return getter_fn.apply(options.context, args); }); }); return constraint.get(); }
javascript
function () { var args = slice.call(arguments), constraint = options.args_map.getOrPut(args, function() { return new Constraint(function () { return getter_fn.apply(options.context, args); }); }); return constraint.get(); }
[ "function", "(", ")", "{", "var", "args", "=", "slice", ".", "call", "(", "arguments", ")", ",", "constraint", "=", "options", ".", "args_map", ".", "getOrPut", "(", "args", ",", "function", "(", ")", "{", "return", "new", "Constraint", "(", "function"...
When getting a value either create a constraint or return the existing value
[ "When", "getting", "a", "value", "either", "create", "a", "constraint", "or", "return", "the", "existing", "value" ]
98a164063efc8d3b59a372b332c7a3e0a1292561
https://github.com/soney/constraintjs/blob/98a164063efc8d3b59a372b332c7a3e0a1292561/src/memoize.js#L76-L84
train
soney/constraintjs
src/liven.js
function (silent) { if(options.on_destroy) { options.on_destroy.call(options.context, silent); } node.destroy(silent); }
javascript
function (silent) { if(options.on_destroy) { options.on_destroy.call(options.context, silent); } node.destroy(silent); }
[ "function", "(", "silent", ")", "{", "if", "(", "options", ".", "on_destroy", ")", "{", "options", ".", "on_destroy", ".", "call", "(", "options", ".", "context", ",", "silent", ")", ";", "}", "node", ".", "destroy", "(", "silent", ")", ";", "}" ]
Destroy the node and make sure no memory is allocated
[ "Destroy", "the", "node", "and", "make", "sure", "no", "memory", "is", "allocated" ]
98a164063efc8d3b59a372b332c7a3e0a1292561
https://github.com/soney/constraintjs/blob/98a164063efc8d3b59a372b332c7a3e0a1292561/src/liven.js#L59-L64
train
soney/constraintjs
src/liven.js
function () { if(paused === true) { paused = false; node.onChangeWithPriority(options.priority, do_get); if(options.run_on_create !== false) { if (constraint_solver.semaphore >= 0) { node.get(false); } else { each(node._changeListeners, constraint_solver.add_in_call_...
javascript
function () { if(paused === true) { paused = false; node.onChangeWithPriority(options.priority, do_get); if(options.run_on_create !== false) { if (constraint_solver.semaphore >= 0) { node.get(false); } else { each(node._changeListeners, constraint_solver.add_in_call_...
[ "function", "(", ")", "{", "if", "(", "paused", "===", "true", ")", "{", "paused", "=", "false", ";", "node", ".", "onChangeWithPriority", "(", "options", ".", "priority", ",", "do_get", ")", ";", "if", "(", "options", ".", "run_on_create", "!==", "fal...
Re-add to the event queue
[ "Re", "-", "add", "to", "the", "event", "queue" ]
98a164063efc8d3b59a372b332c7a3e0a1292561
https://github.com/soney/constraintjs/blob/98a164063efc8d3b59a372b332c7a3e0a1292561/src/liven.js#L77-L91
train
soney/constraintjs
src/binding.js
function(options) { this.options = options; this.targets = options.targets; // the DOM nodes var setter = options.setter, // a function that sets the attribute value getter = options.getter, // a function that gets the attribute value init_val = options.init_val, // the value of the attribute before the binding ...
javascript
function(options) { this.options = options; this.targets = options.targets; // the DOM nodes var setter = options.setter, // a function that sets the attribute value getter = options.getter, // a function that gets the attribute value init_val = options.init_val, // the value of the attribute before the binding ...
[ "function", "(", "options", ")", "{", "this", ".", "options", "=", "options", ";", "this", ".", "targets", "=", "options", ".", "targets", ";", "// the DOM nodes", "var", "setter", "=", "options", ".", "setter", ",", "// a function that sets the attribute value"...
A binding calls some arbitrary functions passed into options. It is responsible for keeping some aspect of a DOM node in line with a constraint value. For example, it might keep an element's class name in sync with a class_name constraint @private @class cjs.Binding @param {object} options @classdesc Bind a DOM node p...
[ "A", "binding", "calls", "some", "arbitrary", "functions", "passed", "into", "options", ".", "It", "is", "responsible", "for", "keeping", "some", "aspect", "of", "a", "DOM", "node", "in", "line", "with", "a", "constraint", "value", ".", "For", "example", "...
98a164063efc8d3b59a372b332c7a3e0a1292561
https://github.com/soney/constraintjs/blob/98a164063efc8d3b59a372b332c7a3e0a1292561/src/binding.js#L79-L126
train
soney/constraintjs
src/binding.js
function() { this._timeout_id = false; // Make it clear that I don't have a timeout set var new_targets = filter(get_dom_array(this.targets), isAnyElement); // update the list of targets if(has(options, "onChange")) { options.onChange.call(this, curr_value, last_value); } // For every target, updat...
javascript
function() { this._timeout_id = false; // Make it clear that I don't have a timeout set var new_targets = filter(get_dom_array(this.targets), isAnyElement); // update the list of targets if(has(options, "onChange")) { options.onChange.call(this, curr_value, last_value); } // For every target, updat...
[ "function", "(", ")", "{", "this", ".", "_timeout_id", "=", "false", ";", "// Make it clear that I don't have a timeout set", "var", "new_targets", "=", "filter", "(", "get_dom_array", "(", "this", ".", "targets", ")", ",", "isAnyElement", ")", ";", "// update the...
the DOM nodes
[ "the", "DOM", "nodes" ]
98a164063efc8d3b59a372b332c7a3e0a1292561
https://github.com/soney/constraintjs/blob/98a164063efc8d3b59a372b332c7a3e0a1292561/src/binding.js#L88-L103
train
soney/constraintjs
src/map.js
function (infos, silent) { each(infos, function (info) { info.key.destroy(silent); info.value.destroy(silent); info.index.destroy(silent); }); }
javascript
function (infos, silent) { each(infos, function (info) { info.key.destroy(silent); info.value.destroy(silent); info.index.destroy(silent); }); }
[ "function", "(", "infos", ",", "silent", ")", "{", "each", "(", "infos", ",", "function", "(", "info", ")", "{", "info", ".", "key", ".", "destroy", "(", "silent", ")", ";", "info", ".", "value", ".", "destroy", "(", "silent", ")", ";", "info", "...
Deallocate memory from constraints
[ "Deallocate", "memory", "from", "constraints" ]
98a164063efc8d3b59a372b332c7a3e0a1292561
https://github.com/soney/constraintjs/blob/98a164063efc8d3b59a372b332c7a3e0a1292561/src/map.js#L370-L376
train
soney/constraintjs
src/map.js
function (index, silent) { var info = this._ordered_values[index]; _destroy_info(this._ordered_values.splice(index, 1), silent); if(silent !== true) { this.$size.invalidate(); } }
javascript
function (index, silent) { var info = this._ordered_values[index]; _destroy_info(this._ordered_values.splice(index, 1), silent); if(silent !== true) { this.$size.invalidate(); } }
[ "function", "(", "index", ",", "silent", ")", "{", "var", "info", "=", "this", ".", "_ordered_values", "[", "index", "]", ";", "_destroy_info", "(", "this", ".", "_ordered_values", ".", "splice", "(", "index", ",", "1", ")", ",", "silent", ")", ";", ...
removes the selected item and destroys its value to deallocate it
[ "removes", "the", "selected", "item", "and", "destroys", "its", "value", "to", "deallocate", "it" ]
98a164063efc8d3b59a372b332c7a3e0a1292561
https://github.com/soney/constraintjs/blob/98a164063efc8d3b59a372b332c7a3e0a1292561/src/map.js#L379-L385
train
soney/constraintjs
src/template/cjs_template.js
function(dom_node) { var index = get_template_instance_index(getFirstDOMChild(dom_node)), instance = index >= 0 ? template_instances[index] : false; if(instance) { delete template_instances[index]; instance.destroy(); } return this; }
javascript
function(dom_node) { var index = get_template_instance_index(getFirstDOMChild(dom_node)), instance = index >= 0 ? template_instances[index] : false; if(instance) { delete template_instances[index]; instance.destroy(); } return this; }
[ "function", "(", "dom_node", ")", "{", "var", "index", "=", "get_template_instance_index", "(", "getFirstDOMChild", "(", "dom_node", ")", ")", ",", "instance", "=", "index", ">=", "0", "?", "template_instances", "[", "index", "]", ":", "false", ";", "if", ...
Destroy a template instance @method cjs.destroyTemplate @param {dom} node - The dom node created by `createTemplate` @return {boolean} - Whether the template was successfully removed @see cjs.createTemplate @see cjs.pauseTemplate @see cjs.resumeTemplate
[ "Destroy", "a", "template", "instance" ]
98a164063efc8d3b59a372b332c7a3e0a1292561
https://github.com/soney/constraintjs/blob/98a164063efc8d3b59a372b332c7a3e0a1292561/src/template/cjs_template.js#L963-L972
train
soney/constraintjs
src/template/cjs_template.js
function(str, context) { return cjs(function() { try { var node = jsep(cjs.get(str)); if(node.type === LITERAL) { return node.value; } else { return get_node_value(node, context, [context]); } } catch(e) { console.error(e); } }); }
javascript
function(str, context) { return cjs(function() { try { var node = jsep(cjs.get(str)); if(node.type === LITERAL) { return node.value; } else { return get_node_value(node, context, [context]); } } catch(e) { console.error(e); } }); }
[ "function", "(", "str", ",", "context", ")", "{", "return", "cjs", "(", "function", "(", ")", "{", "try", "{", "var", "node", "=", "jsep", "(", "cjs", ".", "get", "(", "str", ")", ")", ";", "if", "(", "node", ".", "type", "===", "LITERAL", ")",...
Parses a string and returns a constraint whose value represents the result of `eval`ing that string @method cjs.createParsedConstraint @param {string} str - The string to parse @param {object} context - The context in which to look for variables @return {cjs.Cosntraint} - Whether the template was successfully resumed ...
[ "Parses", "a", "string", "and", "returns", "a", "constraint", "whose", "value", "represents", "the", "result", "of", "eval", "ing", "that", "string" ]
98a164063efc8d3b59a372b332c7a3e0a1292561
https://github.com/soney/constraintjs/blob/98a164063efc8d3b59a372b332c7a3e0a1292561/src/template/cjs_template.js#L1022-L1036
train
nteract/kernelspecs
lib/traverse.js
promisify
function promisify(f, args) { return new Promise((resolve, reject) => f.apply(this, args.concat((err, x) => err ? reject(err) : resolve(x)))); }
javascript
function promisify(f, args) { return new Promise((resolve, reject) => f.apply(this, args.concat((err, x) => err ? reject(err) : resolve(x)))); }
[ "function", "promisify", "(", "f", ",", "args", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "f", ".", "apply", "(", "this", ",", "args", ".", "concat", "(", "(", "err", ",", "x", ")", "=>", "err", "?", "...
Converts a callback style call to a Promise @param {function} f a node style function that accepts a callback @param {Object[]} args arguments to pass to the function when invoking it @return {Promise<Object>} object returned by the function
[ "Converts", "a", "callback", "style", "call", "to", "a", "Promise" ]
fee333ef5561e2eede5242b3affd98d37b173343
https://github.com/nteract/kernelspecs/blob/fee333ef5561e2eede5242b3affd98d37b173343/lib/traverse.js#L11-L13
train
nteract/kernelspecs
lib/traverse.js
getKernelResources
function getKernelResources(kernelInfo) { return promisify(fs.readdir, [kernelInfo.resourceDir]).then(files => { const kernelJSONIndex = files.indexOf('kernel.json'); if (kernelJSONIndex === -1) { throw new Error('kernel.json not found'); } return promisify(fs.readFile, [path.join(kernelInfo.re...
javascript
function getKernelResources(kernelInfo) { return promisify(fs.readdir, [kernelInfo.resourceDir]).then(files => { const kernelJSONIndex = files.indexOf('kernel.json'); if (kernelJSONIndex === -1) { throw new Error('kernel.json not found'); } return promisify(fs.readFile, [path.join(kernelInfo.re...
[ "function", "getKernelResources", "(", "kernelInfo", ")", "{", "return", "promisify", "(", "fs", ".", "readdir", ",", "[", "kernelInfo", ".", "resourceDir", "]", ")", ".", "then", "(", "files", "=>", "{", "const", "kernelJSONIndex", "=", "files", ".", "ind...
Get a kernel resources object @param {Object} kernelInfo description of a kernel @param {string} kernelInfo.name name of the kernel @param {string} kernelInfo.resourceDir kernel's resources directory @return {Promise<Object>} Promise for a kernelResources object
[ "Get", "a", "kernel", "resources", "object" ]
fee333ef5561e2eede5242b3affd98d37b173343
https://github.com/nteract/kernelspecs/blob/fee333ef5561e2eede5242b3affd98d37b173343/lib/traverse.js#L22-L36
train
nteract/kernelspecs
lib/traverse.js
getKernelInfos
function getKernelInfos(directory) { return promisify(fs.readdir, [directory]).then(files => files.map(fileName => ({ name: fileName, resourceDir: path.join(directory, fileName), })) ); }
javascript
function getKernelInfos(directory) { return promisify(fs.readdir, [directory]).then(files => files.map(fileName => ({ name: fileName, resourceDir: path.join(directory, fileName), })) ); }
[ "function", "getKernelInfos", "(", "directory", ")", "{", "return", "promisify", "(", "fs", ".", "readdir", ",", "[", "directory", "]", ")", ".", "then", "(", "files", "=>", "files", ".", "map", "(", "fileName", "=>", "(", "{", "name", ":", "fileName",...
Gets a list of kernelInfo objects for a given directory of kernels @param {string} directory path to a directory full of kernels @return {Promise<Object[]>} Promise for an array of kernelInfo objects
[ "Gets", "a", "list", "of", "kernelInfo", "objects", "for", "a", "given", "directory", "of", "kernels" ]
fee333ef5561e2eede5242b3affd98d37b173343
https://github.com/nteract/kernelspecs/blob/fee333ef5561e2eede5242b3affd98d37b173343/lib/traverse.js#L43-L50
train
nteract/kernelspecs
lib/traverse.js
find
function find(kernelName) { return jp.dataDirs({ withSysPrefix: true }).then(dirs => { const kernelInfos = dirs.map(dir => ({ name: kernelName, resourceDir: path.join(dir, 'kernels', kernelName), })) return extractKernelResources(kernelInfos); }).then(kernelResource => kernelResource[kerne...
javascript
function find(kernelName) { return jp.dataDirs({ withSysPrefix: true }).then(dirs => { const kernelInfos = dirs.map(dir => ({ name: kernelName, resourceDir: path.join(dir, 'kernels', kernelName), })) return extractKernelResources(kernelInfos); }).then(kernelResource => kernelResource[kerne...
[ "function", "find", "(", "kernelName", ")", "{", "return", "jp", ".", "dataDirs", "(", "{", "withSysPrefix", ":", "true", "}", ")", ".", "then", "(", "dirs", "=>", "{", "const", "kernelInfos", "=", "dirs", ".", "map", "(", "dir", "=>", "(", "{", "n...
find a kernel by name @param {string} kernelName the kernel to locate @return {Object} kernelResource object
[ "find", "a", "kernel", "by", "name" ]
fee333ef5561e2eede5242b3affd98d37b173343
https://github.com/nteract/kernelspecs/blob/fee333ef5561e2eede5242b3affd98d37b173343/lib/traverse.js#L57-L67
train
nteract/kernelspecs
lib/traverse.js
findAll
function findAll() { return jp.dataDirs({ withSysPrefix: true }).then(dirs => { return Promise.all(dirs // get kernel infos for each directory and ignore errors .map(dir => getKernelInfos(path.join(dir, 'kernels')).catch(() => {})) ).then(extractKernelResources) }); }
javascript
function findAll() { return jp.dataDirs({ withSysPrefix: true }).then(dirs => { return Promise.all(dirs // get kernel infos for each directory and ignore errors .map(dir => getKernelInfos(path.join(dir, 'kernels')).catch(() => {})) ).then(extractKernelResources) }); }
[ "function", "findAll", "(", ")", "{", "return", "jp", ".", "dataDirs", "(", "{", "withSysPrefix", ":", "true", "}", ")", ".", "then", "(", "dirs", "=>", "{", "return", "Promise", ".", "all", "(", "dirs", "// get kernel infos for each directory and ignore error...
Get an array of kernelResources objects for the host environment This matches the Jupyter notebook API for kernelspecs exactly @return {Promise<Object<string,kernelResource>} Promise for an array of kernelResources objects
[ "Get", "an", "array", "of", "kernelResources", "objects", "for", "the", "host", "environment", "This", "matches", "the", "Jupyter", "notebook", "API", "for", "kernelspecs", "exactly" ]
fee333ef5561e2eede5242b3affd98d37b173343
https://github.com/nteract/kernelspecs/blob/fee333ef5561e2eede5242b3affd98d37b173343/lib/traverse.js#L90-L97
train