_id
stringlengths 2
6
| title
stringlengths 0
58
| partition
stringclasses 3
values | text
stringlengths 27
233k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q64800 | getDefinedNames | test | function getDefinedNames() {
return Object.keys(primitives).concat(Object.keys(registry).map(function | javascript | {
"resource": ""
} |
q64801 | test | function(comment) {
const isLicense =
comment.toLowerCase().includes("license") ||
comment.toLowerCase().includes("copyright");
if (isLicense === false) {
return false;
}
if (lastLicense !== comment) {
| javascript | {
"resource": ""
} |
|
q64802 | get | test | function get(k) {
if(!k) return _SETTINGS
let v = _.get(_SETTINGS, k)
if(!v) return
if(_.isString(k) && k.indexOf('paths.') !== 0) return v
let | javascript | {
"resource": ""
} |
q64803 | load | test | function load(src) {
if(!src || !_.isString(src)) return
let file = _.attempt(require, | javascript | {
"resource": ""
} |
q64804 | test | function(size, units) {
// Size set to a value which means "auto"
if (size === "" || size == "auto" || size === undefined || size === null) {
return size || '';
}
// Otherwise, warn if it's not a valid CSS measurement
if (Ext.isNumber(size) || | javascript | {
"resource": ""
} |
|
q64805 | test | function(form) {
var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,
hasSubmit = false,
encoder = encodeURIComponent,
name,
data = '',
type,
hasValue;
Ext.each(fElements, function(element) {
name = element.name;
type = element.type;
if (!element.disabled && name) {
if (/select-(one|multiple)/i.test(type)) {
Ext.each(element.options, function(opt) {
if (opt.selected) {
hasValue = opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttributeNode('value').specified;
data += Ext.String.format("{0}={1}&", encoder(name), encoder(hasValue ? opt.value : opt.text));
}
}); | javascript | {
"resource": ""
} |
|
q64806 | test | function() {
//<debug warn>
Ext.Logger.deprecate("Ext.Element.getDocumentWidth() is no longer supported. " +
"Please use Ext.Viewport#getWindowWidth() instead", this);
//</debug>
| javascript | {
"resource": ""
} |
|
q64807 | test | function() {
//<debug warn>
Ext.Logger.deprecate("Ext.Element.getOrientation() is no longer supported. " +
"Please use Ext.Viewport#getOrientation() instead", this);
//</debug>
if (Ext.supports.OrientationChange) {
return (window.orientation | javascript | {
"resource": ""
} |
|
q64808 | test | function(el, config) {
config = config || {};
Ext.apply(this, config);
this.addEvents(
/**
* @event sortstart
* @param {Ext.Sortable} this
* @param {Ext.event.Event} e
*/
'sortstart',
/**
* @event sortend
* @param {Ext.Sortable} this
* @param {Ext.event.Event} e
*/
'sortend',
/**
* @event sortchange
* @param {Ext.Sortable} this
* @param {Ext.Element} el The Element being dragged.
* @param {Number} index The index of the element after the sort change.
*/
'sortchange'
// not yet implemented.
// 'sortupdate',
// 'sortreceive',
// 'sortremove',
// 'sortenter',
// 'sortleave',
// 'sortactivate',
| javascript | {
"resource": ""
} |
|
q64809 | test | function() {
this.el.on(this.startEventName, this.onStart, this, | javascript | {
"resource": ""
} |
|
q64810 | _compareMaps | test | function _compareMaps(a,b, options) {
debug(a,b);
let alength = a.size === undefined ? a.length : a.size;
let blength = b.size === undefined ? b.length : b.size;
if (alength === 0 && blength === 0) return ops.NOP;
// ops.Map([...b]) and not just ops.Rpl(b) because if b is a map it's not good JSON.
if (alength === 0 || blength === 0) return new ops.Map([...b]);
let patch = [];
if (!options.sorted) {
a = Array.from(a).sort((a,b) => utils.compare(a,b,options));
b = Array.from(b).sort((a,b) => utils.compare(a,b,options));
}
let ai = 1, bi = 1;
let ao = a[0], bo = b[0]
let element_options = options.getArrayElementOptions();
do {
let comparison = utils.compare(ao,bo,options);
debug("comparing items", ao, bo, comparison);
if (comparison < 0) {
debug('skip');
ao = a[ai++];
} else if (comparison > 0) {
debug('insert');
patch.push([options.key(bo), new ops.Ins(options.value(bo))]);
bo = b[bi++];
} else {
| javascript | {
"resource": ""
} |
q64811 | compare | test | function compare(a,b,options) {
debug('compare %j,%j options: %j', a, b, options);
options = Options.addDefaults(options);
debug('compare - options %j', options);
if (a === b)
return ops.NOP;
if (b === undefined)
return ops.DEL;
if (a === undefined)
return new ops.Rpl(b);
if (typeof a === 'object' && typeof b === 'object') {
if (utils.isArrayLike(a) && utils.isArrayLike(b)) {
if (options.map) {
return _compareMaps(a,b,options);
} else {
| javascript | {
"resource": ""
} |
q64812 | fromJSON | test | function fromJSON(object) {
if (object instanceof ops.Op) return object; // If already patch, return it
if (object === undefined) return ops.NOP;
if (object.op) {
if (object.op === ops.Rpl.name)
return new ops.Rpl(object.data);
if (object.op === ops.Ins.name)
return new ops.Ins(object.data);
else if (object.op === ops.NOP.name)
return ops.NOP;
else if (object.op === ops.DEL.name)
return ops.DEL;
else if (object.op === ops.Mrg.name)
| javascript | {
"resource": ""
} |
q64813 | test | function(sorterFn) {
var me = this,
items = me.items,
keys = me.keys,
length = items.length,
temp = [],
i;
//first we create a copy of the items array so that we can sort it
for (i = 0; i < length; i++) {
temp[i] = {
key : keys[i],
value: items[i],
| javascript | {
"resource": ""
} |
|
q64814 | test | function(mapping) {
var me = this,
items = me.items,
index = 0,
length = items.length,
order = [],
remaining = [],
oldIndex;
me.suspendEvents();
//object of {oldPosition: newPosition} reversed to {newPosition: oldPosition}
for (oldIndex in mapping) {
order[mapping[oldIndex]] = items[oldIndex];
}
for (index = 0; index < length; index++) {
if (mapping[index] == undefined) {
| javascript | {
"resource": ""
} |
|
q64815 | apply | test | function apply (func, args, self) {
return (typeof | javascript | {
"resource": ""
} |
q64816 | detectDeviceClass | test | function detectDeviceClass() {
var body = document.body;
if (isMobile.any()) {
body.classList.add('mobile');
}
if (isMobile.Android()) {
| javascript | {
"resource": ""
} |
q64817 | detectWindowWidth | test | function detectWindowWidth() {
var mobileWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 730;
var isMobileWidth = window.innerWidth < mobileWidth;
var body = document.body;
if (isMobileWidth) | javascript | {
"resource": ""
} |
q64818 | test | function(config,callback,scope) {
var changed= false;
if (config) {
config.config_id= 'csv';
Ext.data.CSV.superclass.constructor.call(this, config);
if (config.v) {
this.v= [];
this.do_add(config.v); | javascript | {
"resource": ""
} |
|
q64819 | test | function(array, insert, at) {
at = Math.min(Math.max(at, 0), array.length);
var tail = Array(array.length - at);
var length = insert.length;
for (var i = 0; i < tail.length; i++) tail[i] = array[i + at]; | javascript | {
"resource": ""
} |
|
q64820 | test | function(models, options) {
options = _.extend({}, options);
var singular = !_.isArray(models);
models = singular ? [models] : _.clone(models);
var removed = this._removeModels(models, options);
| javascript | {
"resource": ""
} |
|
q64821 | test | function(models, options) {
var removed = [];
for (var i = 0; i < models.length; i++) {
var model = this.get(models[i]);
if (!model) continue;
var index = this.indexOf(model);
this.models.splice(index, 1);
this.length--;
if (!options.silent) {
| javascript | {
"resource": ""
} |
|
q64822 | test | function() {
var path = this.decodeFragment(this.location.pathname);
var root = | javascript | {
"resource": ""
} |
|
q64823 | getViewTemplateData | test | function getViewTemplateData ( view, viewOptions ) {
var data,
meta = view.declarativeViews.meta;
if ( ! meta.processed ) {
if ( view.template && _.isString( view.template ) ) {
meta.originalTemplateProp = view.template;
data = getTemplateData( view.template, view, viewOptions );
meta.processed = true;
meta.inGlobalCache = true;
if ( data ) events.trigger( "cacheEntry:view:process", _copyCacheEntry( data ), meta.originalTemplateProp, view, viewOptions );
} else {
data = undefined;
| javascript | {
"resource": ""
} |
q64824 | clearCache | test | function clearCache ( fromMarionette ) {
templateCache = {};
if ( ! fromMarionette && Backbone.Marionette && | javascript | {
"resource": ""
} |
q64825 | clearCachedTemplate | test | function clearCachedTemplate ( templateProp ) {
var fromMarionette = false,
args = _.toArray( arguments ),
lastArg = _.last( args );
// When called from Marionette, or called recursively, the last argument is a "fromMarionette" boolean. Splice
// it off before proceeding.
if ( args.length && _.isBoolean( lastArg ) ) fromMarionette = args.pop();
// Handle multiple template props passed in as a varargs list, or as an array, with recursive calls for each
// template property.
if ( args.length > 1 ) {
_.each( args, function ( singleProp ) { clearCachedTemplate( singleProp, fromMarionette ); } );
} else if ( _.isArray( templateProp ) || _.isArguments( templateProp ) ) {
_.each( templateProp, function ( singleProp ) { clearCachedTemplate( singleProp, fromMarionette ); } );
} else {
if ( ! templateProp ) throw new GenericError( "Missing argument: string identifying the template. The string should be a template selector or the raw HTML of a template, as provided to the template property of a view when the cache entry was created" );
// Dealing with a single templateProp argument.
//
// Delete the | javascript | {
"resource": ""
} |
q64826 | clearViewTemplateCache | test | function clearViewTemplateCache ( view ) {
var meta = view.declarativeViews.meta;
if ( meta.processed ) {
if ( meta.inGlobalCache | javascript | {
"resource": ""
} |
q64827 | _copyCacheEntry | test | function _copyCacheEntry ( cacheEntry ) {
var copy = _.clone( cacheEntry ); | javascript | {
"resource": ""
} |
q64828 | _createTemplateCache | test | function _createTemplateCache( templateProp, view, viewOptions ) {
var $template, data, html,
customLoader = Backbone.DeclarativeViews.custom.loadTemplate,
defaultLoader = Backbone.DeclarativeViews.defaults.loadTemplate,
modifiedDefaultLoader = defaultLoader !== loadTemplate,
cacheId = templateProp;
// Load the template
try {
$template = customLoader ? customLoader( templateProp, view, viewOptions ) : defaultLoader( templateProp, view, viewOptions );
} catch ( err ) {
// Rethrow and exit if the alarm has been raised deliberately, using an error type of Backbone.DeclarativeViews.
if( _isDeclarativeViewsErrorType( err ) ) throw err;
// Otherwise, continue without having fetched a template.
$template = "";
}
if ( ( customLoader || modifiedDefaultLoader ) && $template !== "" && ! ( $template instanceof Backbone.$ ) ) {
throw new CustomizationError( "Invalid return value. The " + ( customLoader ? "custom" : "default" ) + " loadTemplate function must return a jQuery instance, but it hasn't" );
}
// Create cache entry
if ( $template.length ) {
// Read the el-related data attributes of the template.
| javascript | {
"resource": ""
} |
q64829 | _updateJQueryDataCache | test | function _updateJQueryDataCache ( $elem ) {
var add = {},
remove = [];
if ( $.hasData( $elem[0] ) ) {
// A jQuery data cache exists. Update it for the el properties (and attribute names registered by a plugin).
// Primitive data types. Normally, this will read the "data-tag-name", "data-class-name" and "data-id"
// attributes.
_.each( registeredDataAttributes.primitives, function ( attributeName ) {
var attributeValue = $elem.attr( "data-" + attributeName );
if ( attributeValue === undefined ) {
remove.push( attributeName );
} else {
add[toCamelCase( attributeName )] = attributeValue;
}
} );
// Stringified JSON data. Normally, this just deals with "data-attributes".
_.each( registeredDataAttributes.json, function ( attributeName ) {
var attributeValue = $elem.attr( "data-" | javascript | {
"resource": ""
} |
q64830 | _registerCacheAlias | test | function _registerCacheAlias( namespaceObject, instanceCachePropertyName ) {
namespaceObject.getCachedTemplate = Backbone.DeclarativeViews.getCachedTemplate;
namespaceObject.clearCachedTemplate = Backbone.DeclarativeViews.clearCachedTemplate;
namespaceObject.clearCache = Backbone.DeclarativeViews.clearCache;
namespaceObject.custom = Backbone.DeclarativeViews.custom;
| javascript | {
"resource": ""
} |
q64831 | _isDeclarativeViewsErrorType | test | function _isDeclarativeViewsErrorType ( error ) {
return error instanceof GenericError ||
error instanceof TemplateError ||
error instanceof CompilerError ||
| javascript | {
"resource": ""
} |
q64832 | createCustomErrorType | test | function createCustomErrorType ( name ) {
function CustomError ( message ) {
this.message = message;
if ( Error.captureStackTrace ) {
Error.captureStackTrace( this, this.constructor );
| javascript | {
"resource": ""
} |
q64833 | test | function(name) {
var config = this._wreqrHandlers[name];
if (!config) {
return;
}
return function() {
| javascript | {
"resource": ""
} |
|
q64834 | test | function(name) {
name = arguments[0];
var args = _.rest(arguments);
if (this.hasHandler(name)) {
this.getHandler(name).apply(this, args);
| javascript | {
"resource": ""
} |
|
q64835 | test | function(type, hash, context) {
if (!hash) {
return;
}
context = context || this;
var method = type === "vent" ? "on" : "setHandler";
| javascript | {
"resource": ""
} |
|
q64836 | iterateEvents | test | function iterateEvents(target, entity, bindings, functionCallback, stringCallback) {
if (!entity || !bindings) { return; }
// type-check bindings
if (!_.isObject(bindings)) {
throw new Marionette.Error({
message: 'Bindings must be an object or function.',
url: 'marionette.functions.html#marionettebindentityevents'
});
}
// allow the bindings to be a function
bindings = Marionette._getValue(bindings, target);
// iterate the bindings and bind them
_.each(bindings, function(methods, evt) {
| javascript | {
"resource": ""
} |
q64837 | test | function(callback, contextOverride) {
var promise = _.result(this._deferred, 'promise');
this._callbacks.push({cb: callback, ctx: contextOverride});
promise.then(function(args) {
| javascript | {
"resource": ""
} |
|
q64838 | test | function(view, options) {
if (!this._ensureElement()) {
return;
}
this._ensureViewIsIntact(view);
Marionette.MonitorDOMRefresh(view);
var showOptions = options || {};
var isDifferentView = view !== this.currentView;
var preventDestroy = !!showOptions.preventDestroy;
var forceShow = !!showOptions.forceShow;
// We are only changing the view if there is a current view to change to begin with
var isChangingView = !!this.currentView;
// Only destroy the current view if we don't want to `preventDestroy` and if
// the view given in the first argument is different than `currentView`
var _shouldDestroyView = isDifferentView && !preventDestroy;
// Only show the view given in the first argument if it is different than
// the current view or if we want to re-show the view. Note that if
// `_shouldDestroyView` is true, then `_shouldShowView` is also necessarily true.
var _shouldShowView = isDifferentView || forceShow;
if (isChangingView) {
this.triggerMethod('before:swapOut', this.currentView, this, options);
}
if (this.currentView && isDifferentView) {
delete this.currentView._parent;
}
if (_shouldDestroyView) {
this.empty();
// A `destroy` event is attached to the clean up manually removed views.
// We need to detach this event when a new view is going to be shown as it
// is no longer relevant.
} else if (isChangingView && _shouldShowView) {
this.currentView.off('destroy', this.empty, this);
}
if (_shouldShowView) {
// We need to listen for if a view is destroyed
// in a way other than through the region.
// If this happens we need to remove the reference
// to the currentView since once a view has been destroyed
// we can not reuse it.
view.once('destroy', this.empty, this);
// make this region the view's parent,
// It's important that this parent binding happens before rendering
// so that any events the child may trigger during render can also be
// triggered on the child's ancestor views
view._parent = this;
this._renderView(view);
if (isChangingView) {
this.triggerMethod('before:swap', view, this, options);
}
this.triggerMethod('before:show', view, this, options);
Marionette.triggerMethodOn(view, 'before:show', view, this, options);
| javascript | {
"resource": ""
} |
|
q64839 | test | function(options) {
var view = this.currentView;
var emptyOptions = options || {};
var preventDestroy = !!emptyOptions.preventDestroy;
// If there is no view in the region
// we should not remove anything
if (!view) { return this; }
view.off('destroy', this.empty, this);
this.triggerMethod('before:empty', view);
if (!preventDestroy) {
| javascript | {
"resource": ""
} |
|
q64840 | test | function(regionDefinitions, defaults) {
regionDefinitions = Marionette._getValue(regionDefinitions, this, arguments);
return _.reduce(regionDefinitions, function(regions, definition, name) {
if (_.isString(definition)) {
definition = {selector: definition};
}
| javascript | {
"resource": ""
} |
|
q64841 | test | function(name, definition) {
var region;
if (definition instanceof Marionette.Region) {
region = definition;
} else {
region = Marionette.Region.buildRegion(definition, Marionette.Region);
}
this.triggerMethod('before:add:region', | javascript | {
"resource": ""
} |
|
q64842 | test | function() {
var regions = this.getRegions();
_.each(this._regions, function(region, name) {
| javascript | {
"resource": ""
} |
|
q64843 | test | function(name, region) {
this.triggerMethod('before:remove:region', name, region);
region.empty();
region.stopListening();
delete region._parent;
| javascript | {
"resource": ""
} |
|
q64844 | test | function(templateId, options) {
var cachedTemplate = this.templateCaches[templateId];
if (!cachedTemplate) {
cachedTemplate = new Marionette.TemplateCache(templateId);
| javascript | {
"resource": ""
} |
|
q64845 | test | function(options) {
// Guard clause to prevent loading this template more than once
if (this.compiledTemplate) {
return this.compiledTemplate;
| javascript | {
"resource": ""
} |
|
q64846 | test | function(template, data) {
if (!template) {
throw new Marionette.Error({
name: 'TemplateNotFoundError',
message: 'Cannot render the template since its false, null or undefined.'
});
}
var templateFunc | javascript | {
"resource": ""
} |
|
q64847 | test | function(target) {
target = target || {};
var templateHelpers = this.getOption('templateHelpers'); | javascript | {
"resource": ""
} |
|
q64848 | test | function(events) {
this._delegateDOMEvents(events);
this.bindEntityEvents(this.model, this.getOption('modelEvents'));
this.bindEntityEvents(this.collection, this.getOption('collectionEvents'));
_.each(this._behaviors, function(behavior) {
| javascript | {
"resource": ""
} |
|
q64849 | test | function(eventsArg) {
var events = Marionette._getValue(eventsArg || this.events, this);
// normalize ui keys
events = this.normalizeUIKeys(events);
if (_.isUndefined(eventsArg)) {this.events = events;}
var combinedEvents = {};
// look up if this view has behavior events
var behaviorEvents = _.result(this, 'behaviorEvents') || {};
var triggers = this.configureTriggers();
var behaviorTriggers = _.result(this, 'behaviorTriggers') | javascript | {
"resource": ""
} |
|
q64850 | test | function() {
Backbone.View.prototype.undelegateEvents.apply(this, arguments);
this.unbindEntityEvents(this.model, this.getOption('modelEvents'));
this.unbindEntityEvents(this.collection, this.getOption('collectionEvents'));
_.each(this._behaviors, function(behavior) {
| javascript | {
"resource": ""
} |
|
q64851 | test | function() {
if (this.isDestroyed) { return this; }
var args = _.toArray(arguments);
this.triggerMethod.apply(this, ['before:destroy'].concat(args));
// mark as destroyed before doing the actual destroy, to
// prevent infinite loops within "destroy" event handlers
// that are trying to destroy other views
this.isDestroyed = true;
this.triggerMethod.apply(this, ['destroy'].concat(args));
// unbind UI elements
this.unbindUIElements();
this.isRendered = false;
// remove the view from the DOM
| javascript | {
"resource": ""
} |
|
q64852 | test | function() {
if (!this.ui) { return; }
// store the ui hash in _uiBindings so they can be reset later
// and so re-rendering the view will be able to find the bindings
if (!this._uiBindings) {
this._uiBindings = this.ui;
}
// get the bindings result, as a function or otherwise
var bindings = | javascript | {
"resource": ""
} |
|
q64853 | test | function() {
var ret = Marionette._triggerMethod(this, arguments);
this._triggerEventOnBehaviors(arguments);
| javascript | {
"resource": ""
} |
|
q64854 | test | function() {
var children = this._getImmediateChildren();
if (!children.length) { return children; }
return _.reduce(children, function(memo, view) {
if (!view._getNestedViews) | javascript | {
"resource": ""
} |
|
q64855 | test | function() {
if (!this.model && !this.collection) {
return {};
}
var args = [this.model || this.collection];
if (arguments.length) {
args.push.apply(args, arguments);
}
if (this.model) {
| javascript | {
"resource": ""
} |
|
q64856 | test | function() {
var template = this.getTemplate();
// Allow template-less item views
if (template === false) {
return;
}
if (!template) {
throw new Marionette.Error({
name: 'UndefinedTemplateError',
| javascript | {
"resource": ""
} |
|
q64857 | test | function() {
if (this.collection) {
this.listenTo(this.collection, 'add', this._onCollectionAdd);
this.listenTo(this.collection, 'remove', this._onCollectionRemove);
this.listenTo(this.collection, 'reset', this.render);
| javascript | {
"resource": ""
} |
|
q64858 | test | function(child, collection, opts) {
// `index` is present when adding with `at` since BB 1.2; indexOf fallback for < 1.2
var index = opts.at !== undefined && (opts.index || collection.indexOf(child));
// When filtered or when there is no initial index, calculate index.
if (this.getOption('filter') || index === false) {
index = _.indexOf(this._filteredSortedModels(index), child);
| javascript | {
"resource": ""
} |
|
q64859 | test | function() {
var models = this._filteredSortedModels();
// check for any changes in sort order of views
var orderChanged = _.find(models, function(item, index) {
var view = this.children.findByModel(item);
| javascript | {
"resource": ""
} |
|
q64860 | test | function() {
this.destroyEmptyView();
this.destroyChildren({checkEmpty: false});
if (this.isEmpty(this.collection)) {
this.showEmptyView();
} else {
this.triggerMethod('before:render:collection', this);
this.startBuffering();
this.showCollection();
this.endBuffering();
this.triggerMethod('render:collection', | javascript | {
"resource": ""
} |
|
q64861 | test | function() {
var ChildView;
var models = this._filteredSortedModels();
_.each(models, function(child, index) {
| javascript | {
"resource": ""
} |
|
q64862 | test | function(addedAt) {
var viewComparator = this.getViewComparator();
var models = this.collection.models;
addedAt = Math.min(Math.max(addedAt, 0), models.length - 1);
if (viewComparator) {
var addedModel;
// Preserve `at` location, even for a sorted view
if (addedAt) {
addedModel = models[addedAt];
models = models.slice(0, addedAt).concat(models.slice(addedAt + 1));
}
models = this._sortModelsBy(models, viewComparator);
if (addedModel) {
models.splice(addedAt, 0, addedModel);
}
| javascript | {
"resource": ""
} |
|
q64863 | test | function() {
var EmptyView = this.getEmptyView();
if (EmptyView && !this._showingEmptyView) {
this.triggerMethod('before:render:empty');
this._showingEmptyView = true;
| javascript | {
"resource": ""
} |
|
q64864 | test | function(child, ChildView, index) {
var childViewOptions = this.getOption('childViewOptions');
childViewOptions = Marionette._getValue(childViewOptions, this, [child, index]);
var view = this.buildChildView(child, ChildView, childViewOptions);
// increment indices of views after this one
this._updateIndices(view, true, index);
| javascript | {
"resource": ""
} |
|
q64865 | test | function(view, index) {
// Only trigger attach if already shown, attached, and not buffering, otherwise endBuffer() or
// Region#show() handles this.
var canTriggerAttach = this._isShown && !this.isBuffering && Marionette.isNodeAttached(this.el);
var nestedViews;
// set up the child view event forwarding
this.proxyChildEvents(view);
view.once('render', function() {
// trigger the 'before:show' event on `view` if the collection view has already been shown
if (this._isShown && !this.isBuffering) {
Marionette.triggerMethodOn(view, 'before:show', view);
}
// Trigger `before:attach` following `render` to avoid adding logic and event triggers
// to public method `renderChildView()`.
if (canTriggerAttach && this._triggerBeforeAttach) {
nestedViews = this._getViewAndNested(view); | javascript | {
"resource": ""
} |
|
q64866 | test | function(view, index) {
if (!view.supportsRenderLifecycle) {
Marionette.triggerMethodOn(view, 'before:render', view);
}
view.render();
if | javascript | {
"resource": ""
} |
|
q64867 | test | function(child, ChildViewClass, childViewOptions) {
var options = _.extend({model: child}, childViewOptions);
| javascript | {
"resource": ""
} |
|
q64868 | test | function(view) {
if (!view) { return view; }
this.triggerMethod('before:remove:child', view);
if (!view.supportsDestroyLifecycle) {
Marionette.triggerMethodOn(view, 'before:destroy', view);
}
// call 'destroy' or 'remove', depending on which is found
if (view.destroy) {
view.destroy();
} else {
view.remove();
}
if (!view.supportsDestroyLifecycle) {
Marionette.triggerMethodOn(view, 'destroy', view);
}
delete view._parent; | javascript | {
"resource": ""
} |
|
q64869 | test | function() {
var elBuffer = document.createDocumentFragment();
_.each(this._bufferedChildren, function(b) {
| javascript | {
"resource": ""
} |
|
q64870 | test | function(collectionView, childView, index) {
if (collectionView.isBuffering) {
// buffering happens on reset events and initial renders
// in order to reduce the number of inserts into the
// document, which are expensive.
collectionView._bufferedChildren.splice(index, 0, childView);
} else {
// If we've already rendered the main collection, append
| javascript | {
"resource": ""
} |
|
q64871 | test | function(childView, index) {
var currentView;
var findPosition = this.getOption('sort') && (index < this.children.length - 1);
if (findPosition) {
// Find the view after this one
currentView = this.children.find(function(view) {
return view._index === index + 1;
| javascript | {
"resource": ""
} |
|
q64872 | test | function() {
if (this.isDestroyed) { return this; }
this.triggerMethod('before:destroy:collection');
this.destroyChildren({checkEmpty: false});
| javascript | {
"resource": ""
} |
|
q64873 | test | function(options) {
var destroyOptions = options || {};
var shouldCheckEmpty = true;
var childViews = this.children.map(_.identity);
if (!_.isUndefined(destroyOptions.checkEmpty)) {
shouldCheckEmpty = destroyOptions.checkEmpty;
| javascript | {
"resource": ""
} |
|
q64874 | test | function() {
// Bind only after composite view is rendered to avoid adding child views
// to nonexistent childViewContainer
if (this.collection) {
this.listenTo(this.collection, 'add', this._onCollectionAdd);
this.listenTo(this.collection, 'remove', this._onCollectionRemove);
| javascript | {
"resource": ""
} |
|
q64875 | test | function() {
var data = {};
if (this.model) {
data = _.partial(this.serializeModel, | javascript | {
"resource": ""
} |
|
q64876 | test | function() {
this._ensureViewIsIntact();
this._isRendering = true;
this.resetChildViewContainer();
this.triggerMethod('before:render', this);
this._renderTemplate();
this._renderChildren(); | javascript | {
"resource": ""
} |
|
q64877 | test | function() {
var data = {};
data = this.serializeData();
data = this.mixinTemplateHelpers(data);
this.triggerMethod('before:render:template');
var template = this.getTemplate();
var html = Marionette.Renderer.render(template, data, this);
this.attachElContent(html);
// the ui bindings is done here and not at the end of render since they
| javascript | {
"resource": ""
} |
|
q64878 | test | function(options) {
options = options || {};
this._firstRender = true;
this._initializeRegions(options); | javascript | {
"resource": ""
} |
|
q64879 | test | function() {
this._ensureViewIsIntact();
if (this._firstRender) {
// if this is the first render, don't do anything to
// reset the regions
this._firstRender = false;
} else {
// If this is not the first render call, then we need to
| javascript | {
"resource": ""
} |
|
q64880 | test | function() {
if (this.isDestroyed) { return this; }
// #2134: remove parent element before destroying the child views, so
// removing the child views doesn't retrigger repaints
if (this.getOption('destroyImmediate') === true) {
| javascript | {
"resource": ""
} |
|
q64881 | test | function(regions) {
var defaults = {
regionClass: this.getOption('regionClass'),
parentEl: _.partial(_.result, this, 'el')
| javascript | {
"resource": ""
} |
|
q64882 | test | function(options) {
var regions;
this._initRegionManager();
regions = Marionette._getValue(this.regions, this, [options]) || {};
// Enable users to define `regions` as instance options.
var regionOptions = this.getOption.call(options, 'regions');
// enable region options to be a function
regionOptions = Marionette._getValue(regionOptions, this, [options]);
| javascript | {
"resource": ""
} |
|
q64883 | test | function() {
this.regionManager = this.getRegionManager();
this.regionManager._parent = this;
this.listenTo(this.regionManager, 'before:add:region', function(name) {
this.triggerMethod('before:add:region', name);
});
this.listenTo(this.regionManager, 'add:region', function(name, region) {
this[name] = region;
this.triggerMethod('add:region', name, region);
});
| javascript | {
"resource": ""
} |
|
q64884 | test | function(options, key) {
if (options.behaviorClass) {
return options.behaviorClass;
}
// Get behavior class can be either a flat | javascript | {
"resource": ""
} |
|
q64885 | test | function(view, behaviors) {
return _.chain(behaviors).map(function(options, key) {
var BehaviorClass = Behaviors.getBehaviorClass(options, key);
var behavior = new BehaviorClass(options, view);
| javascript | {
"resource": ""
} |
|
q64886 | test | function(behavior, i) {
var triggersHash = _.clone(_.result(behavior, 'triggers')) || {};
triggersHash = Marionette.normalizeUIKeys(triggersHash, getBehaviorsUI(behavior));
| javascript | {
"resource": ""
} |
|
q64887 | test | function(behavior, i, eventName, trigger) {
// Unique identifier for the `this._triggers` hash
var triggerKey = trigger.replace(/^\S+/, function(triggerName) {
return triggerName + '.' + 'behaviortriggers' | javascript | {
"resource": ""
} |
|
q64888 | test | function(routeName, routeArgs) {
// make sure an onRoute before trying to call it
if (_.isFunction(this.onRoute)) {
// find the path that matches the current route
| javascript | {
"resource": ""
} |
|
q64889 | test | function(moduleNames, moduleDefinition) {
// Overwrite the module class if the user specifies one
var ModuleClass = Marionette.Module.getClass(moduleDefinition);
| javascript | {
"resource": ""
} |
|
q64890 | test | function(options) {
var regions = _.isFunction(this.regions) ? this.regions(options) : this.regions || {};
this._initRegionManager();
// Enable users to define `regions` in instance options.
var optionRegions = Marionette.getOption(options, 'regions');
// Enable region options to be a function
if (_.isFunction(optionRegions)) {
optionRegions | javascript | {
"resource": ""
} |
|
q64891 | test | function() {
this._regionManager = this.getRegionManager();
this._regionManager._parent = this;
this.listenTo(this._regionManager, 'before:add:region', function() {
Marionette._triggerMethod(this, 'before:add:region', arguments);
});
this.listenTo(this._regionManager, 'add:region', function(name, region) {
this[name] = region;
Marionette._triggerMethod(this, 'add:region', arguments);
});
| javascript | {
"resource": ""
} |
|
q64892 | test | function() {
this.channelName = _.result(this, 'channelName') || 'global';
this.channel = _.result(this, 'channel') || Backbone.Wreqr.radio.channel(this.channelName);
this.vent = _.result(this, 'vent') || this.channel.vent;
| javascript | {
"resource": ""
} |
|
q64893 | test | function() {
// if we are not initialized, don't bother finalizing
if (!this._isInitialized) { return; }
this._isInitialized = false;
this.triggerMethod('before:stop');
// stop the sub-modules; depth-first, to make sure the
// sub-modules are stopped / finalized before parents
_.invoke(this.submodules, 'stop');
// run the | javascript | {
"resource": ""
} |
|
q64894 | test | function(app, moduleNames, moduleDefinition) {
var module = app;
// get the custom args passed in after the module definition and
// get rid of the module name and definition function
var customArgs = _.drop(arguments, 3);
// Split the module names and get the number of submodules.
// i.e. an example module name of `Doge.Wow.Amaze` would
// then have the potential for 3 module definitions.
moduleNames = moduleNames.split('.');
var length = moduleNames.length;
// store the module definition for the last module in the chain
var moduleDefinitions = [];
moduleDefinitions[length - 1] = moduleDefinition;
// Loop through all the parts of the | javascript | {
"resource": ""
} |
|
q64895 | test | function(parentModule, module, def, args) {
var fn = this._getDefine(def);
var startWithParent = this._getStartWithParent(def, module);
if (fn) {
| javascript | {
"resource": ""
} |
|
q64896 | _sigName | test | function _sigName(src) {
if (!_.isFunction(src)) return ''
let ret = _.trim(_.replace(src.toString(), 'function', ''))
| javascript | {
"resource": ""
} |
q64897 | test | function() {
var components = this.path.split('/');
for (var i = components.length - 1; i >= 0; --i) {
if (components[i].length > 0) {
| javascript | {
"resource": ""
} |
|
q64898 | test | function(config) {
if (config.parent == null) {
Ext.Logger.error('Ext.device.filesystem.Entry#moveTo: You must specify a new `parent` of the entry.');
return null;
}
var me = this;
this.getEntry(
{
options: config.options || {},
success: function(sourceEntry) {
config.parent.getEntry(
{
options: config.options || {},
success: function(destinationEntry) {
if (config.copy) {
sourceEntry.copyTo(destinationEntry, config.newName, function(entry) {
config.success.call(
config.scope || me,
entry.isDirectory ? Ext.create('Ext.device.filesystem.DirectoryEntry', entry.fullPath, me.fileSystem) : Ext.create('Ext.device.filesystem.FileEntry', entry.fullPath, me.fileSystem)
);
}, config.failure);
} else {
sourceEntry.moveTo(destinationEntry, config.newName, function(entry) {
| javascript | {
"resource": ""
} |
|
q64899 | test | function(config) {
if (!config.success) {
Ext.Logger.error('Ext.device.filesystem.Entry#getParent: You must specify a `success` callback.');
return null;
}
var me = this;
this.getEntry(
{
options: config.options || {},
success: function(entry) {
entry.getParent(
function(parentEntry) {
config.success.call(
config.scope || me,
parentEntry.isDirectory
| javascript | {
"resource": ""
} |