_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
27
233k
language
stringclasses
1 value
meta_information
dict
q34400
train
function(callback) { // everything is copied in case the collection is modified during the cycle var values = this._data_values.slice(), uids = this._data_uids.slice(), names = this._data_names.slice(), i = 0, count
javascript
{ "resource": "" }
q34401
train
function(new_indices) { var i = 0, result = this._createHelperStorage(), index, verification = {}; if (Lava.schema.DEBUG && new_indices.length != this._count) throw "reorder: new item count is less than current"; for (; i < this._count; i++) { index = new_indices[i]; result.push(this._data_uids...
javascript
{ "resource": "" }
q34402
train
function(start_index, count) { if (count <= 0) Lava.t("Invalid item count supplied for removeRange"); if (start_index + count >= this._count + 1) Lava.t("Index is out of range"); var removed_uids = this._data_uids.splice(start_index, count), removed_values = this._data_values.splice(start_index, count), r...
javascript
{ "resource": "" }
q34403
train
function() { return { uids: [], values: [], names: [], push: function(uid, value, name) { this.uids.push(uid); this.values.push(value); this.names.push(name); }, getObject:
javascript
{ "resource": "" }
q34404
train
function(data_source) { this.guid = Lava.guid++; if (data_source) { var count = 0, i = 0, name; if (Array.isArray(data_source)) { for (count = data_source.length; i < count; i++) { this._push(this._uid++, data_source[i], null); } } else if (data_source.isCollection) { this...
javascript
{ "resource": "" }
q34405
train
function(data_source) { if (Lava.schema.DEBUG && typeof(data_source) != 'object') Lava.t("Wrong argument passed to updateFromSourceObject"); if (Array.isArray(data_source)) { this._updateFromArray(data_source, []); } else if (data_source.isCollection) {
javascript
{ "resource": "" }
q34406
train
function(source_array, names) { var i = 0, count = source_array.length, items_removed_argument = { uids: this._data_uids, values: this._data_values, names: this._data_names }; this._data_uids = []; this._data_values = []; this._data_names = [];
javascript
{ "resource": "" }
q34407
train
function(source_object) { var i = 0, name, uid, result = this._createHelperStorage(), removed = this._createHelperStorage(), added = this._createHelperStorage(); for (; i < this._count; i++) { name = this._data_names[i]; if (name != null && (name in source_object)) { if (source_object[n...
javascript
{ "resource": "" }
q34408
train
function(index, value, name) { if (index > this._count) Lava.t("Index is out of range"); var old_uid = this._data_uids[index], old_value = this._data_values[index], old_name = this._data_names[index], new_uid = this._uid++; this._data_uids[index] = new_uid;
javascript
{ "resource": "" }
q34409
train
function(value, name) { var result = false, index = this._data_values.indexOf(value); if (index == -1) {
javascript
{ "resource": "" }
q34410
train
function(start_index, values, names) { if (start_index >= this._count) Lava.t("Index is out of range"); var i = 0, count = values.length, added_uids = [], added_names = []; if (names) { if (count != names.length) Lava.t("If names array is provided, it must be equal length with values array."); ...
javascript
{ "resource": "" }
q34411
train
function() { this._data_names = this._data_source.getNames(); this._data_values = this._data_source.getValues();
javascript
{ "resource": "" }
q34412
train
function(data_source) { if (Lava.schema.DEBUG && !data_source.isCollection) Lava.t("Wrong argument supplied for
javascript
{ "resource": "" }
q34413
train
function(template_config, widget, parent_view, child_properties) { this.guid = Lava.guid++; this._parent_view = parent_view; this._widget = widget; this._config =
javascript
{ "resource": "" }
q34414
train
function(result, children_config, include_name_stack, properties) { var i = 0, count = children_config.length, childConfig, type; for (; i < count; i++) { childConfig = children_config[i]; type = typeof(childConfig); if (type == 'object') type = childConfig.type;
javascript
{ "resource": "" }
q34415
train
function(result, childConfig, include_name_stack, properties) { var constructor = Lava.ClassManager.getConstructor(childConfig['class'], 'Lava.view'), view = new constructor( childConfig, this._widget,
javascript
{ "resource": "" }
q34416
train
function(result, child_config, include_name_stack, properties) { if (include_name_stack.indexOf(child_config.name) != -1) Lava.t("Infinite include recursion"); var include = Lava.view_manager.getInclude(this._parent_view, child_config); if (Lava.schema.DEBUG && include == null) Lava.t("Include not found: " + chi...
javascript
{ "resource": "" }
q34417
train
function(name, value) { for (var i = 0; i < this._count; i++) { if (this._content[i].isView) {
javascript
{ "resource": "" }
q34418
train
function(properties_object) { for (var i = 0; i < this._count; i++) { if (this._content[i].isView) {
javascript
{ "resource": "" }
q34419
train
function(i) { var result = null; while (i < this._count) { if (this._content[i].isView)
javascript
{ "resource": "" }
q34420
train
function(label) { var result = [], i = 0; for (; i < this._count; i++) { if (this._content[i].isView && this._content[i].label == label) {
javascript
{ "resource": "" }
q34421
train
function(name) { var result = [], i = 0; for (; i < this._count; i++) { if (this._content[i].isWidget && this._content[i].name == name) {
javascript
{ "resource": "" }
q34422
train
function() { var default_events = Lava.schema.system.DEFAULT_EVENTS, i = 0, count = default_events.length; for (; i < count; i++)
javascript
{ "resource": "" }
q34423
train
function(view) { if (view.depth in this._dirty_views) { this._dirty_views[view.depth].push(view);
javascript
{ "resource": "" }
q34424
train
function(dirty_views) { var level = 0, deepness, views_list, has_exceptions = false, i, count; deepness = dirty_views.length; // this line must be after ScopeManager#refresh() for (; level < deepness; level++) { if (level in dirty_views) { views_list = dirty_views[level]; for (i = ...
javascript
{ "resource": "" }
q34425
train
function(starting_widget, id) { if (Lava.schema.DEBUG && !id) Lava.t();
javascript
{ "resource": "" }
q34426
train
function(starting_widget, guid) { if (Lava.schema.DEBUG && !guid) Lava.t();
javascript
{ "resource": "" }
q34427
train
function(view, targets, callback, callback_arguments, global_targets_object) { var i = 0, count = targets.length, target, target_name, widget, template_arguments, bubble_index = 0, bubble_targets_copy, bubble_targets_count; this._nested_dispatch_count++; for (; i < count; i++) { tar...
javascript
{ "resource": "" }
q34428
train
function(view, event_name, event_object) { var targets = view.getContainer().getEventTargets(event_name); if (targets) {
javascript
{ "resource": "" }
q34429
train
function(view, event_name, event_object, targets) { this._dispatchCallback( view, targets, this._callHandleEvent, { event_name: event_name,
javascript
{ "resource": "" }
q34430
train
function(view, target) { var result = []; for (var i = 0, count = target.arguments.length; i < count; i++) { if (target.arguments[i].type == Lava.TARGET_ARGUMENT_TYPES.VALUE) { result.push(target.arguments[i].data); } else {
javascript
{ "resource": "" }
q34431
train
function(starting_view, config) { var widget = starting_view.getWidget(), template_arguments = ('arguments' in config) ? this._evalTargetArguments(starting_view, config) : null; if ('locator_type' in config) { widget = this['_locateWidgetBy' +
javascript
{ "resource": "" }
q34432
train
function(element) { var id = Firestorm.Element.getProperty(element, 'id'), result = null; if (id) {
javascript
{ "resource": "" }
q34433
train
function(label) { var result = []; for (var guid in this._views_by_guid) { if (this._views_by_guid[guid].label == label) {
javascript
{ "resource": "" }
q34434
train
function(element) { // note: target of some events can be the root html tag (for example, mousedown on a scroll bar) var document_ref = window.document, // document > html > body > ... result =
javascript
{ "resource": "" }
q34435
train
function(event_name, event_object) { var target = event_object.target, view, container, stack_changed_event_name = event_name + '_stack_changed', stack = target ? this._buildElementStack(target) : [], i = 0, count = stack.length; // Warning! You must not modify the `stack` array! this._fire(st...
javascript
{ "resource": "" }
q34436
train
function(event_name) { if (Lava.schema.DEBUG && ['mouseenter', 'mouseleave', 'mouseover', 'mouseout'].indexOf(event_name) != -1) Lava.t("The following events: mouseenter, mouseleave, mouseover and mouseout are served by common alias - mouse_events"); if (this._event_usage_counters[event_name]) {
javascript
{ "resource": "" }
q34437
train
function(event_name) { if (event_name == 'mouse_events') { this._events_listeners['mouseover'] = Lava.Core.addGlobalHandler('mouseover', this.handleMouseMovement, this); this._events_listeners['mouseout'] =
javascript
{ "resource": "" }
q34438
train
function(event_name) { if (this._event_usage_counters[event_name] == 0) { Lava.logError("ViewManager: trying to release an event with zero usage."); return; } this._event_usage_counters[event_name]--;
javascript
{ "resource": "" }
q34439
train
function(event_name) { if (event_name == 'mouse_events') { Lava.Core.removeGlobalHandler(this._events_listeners['mouseover']); this._events_listeners['mouseover'] = null;
javascript
{ "resource": "" }
q34440
train
function(name) { if (!(name in this._modules)) { var config = Lava.schema.modules[name], className = config.type || Lava.schema.data.DEFAULT_MODULE_CLASS, constructor = Lava.ClassManager.getConstructor(className, 'Lava.data'); // construction is
javascript
{ "resource": "" }
q34441
train
function(schema, raw_tag, parent_title) { var widget_config = Lava.parsers.Common.createDefaultWidgetConfig(), tags, name, x = raw_tag.x; widget_config['extends'] = parent_title; if (raw_tag.content) { // Lava.isVoidTag is a workaround for <x:attach_directives> // It's highly discouraged to mak...
javascript
{ "resource": "" }
q34442
train
function(raw_blocks, widget_config) { var i = 0, count = raw_blocks.length, result = []; for (; i < count; i++) { if (raw_blocks[i].type == 'directive') { if (Lava.parsers.Directives.processDirective(raw_blocks[i], widget_config, true)) Lava.t("Directive
javascript
{ "resource": "" }
q34443
train
function(content_schema, raw_tag, widget_config) { var tags = Lava.parsers.Common.asBlocks(raw_tag.content), i = 0, count, tag_roles_map = content_schema.tag_roles, tag_schema, storage_tags = []; tags = this._applyTopDirectives(tags, widget_config); count = tags.length;
javascript
{ "resource": "" }
q34444
train
function(widget_config, unknown_attributes, resource_name) { var value = { type: 'container_stack', value: [] }, operations_stack = value.value; if (!widget_config.resources) { widget_config.resources = {}; } if (!widget_config.resources['default']) { widget_config.resources['default']...
javascript
{ "resource": "" }
q34445
train
function(widget_config, attribute_value, descriptor, name) { Lava.store( widget_config, 'options', name,
javascript
{ "resource": "" }
q34446
train
function() { if (!this._mouseover_stack_changed_listener) { Lava.view_manager.lendEvent('mouse_events'); this._mouseover_stack_changed_listener =
javascript
{ "resource": "" }
q34447
train
function() { if (this._mouseover_stack_changed_listener) { Lava.view_manager.releaseEvent('mouse_events'); Lava.view_manager.removeListener(this._mouseover_stack_changed_listener);
javascript
{ "resource": "" }
q34448
train
function(view_manager, stack) { var new_tooltip_target = null, html; for (var i = 0, count = stack.length; i < count; i++) { if (Firestorm.Element.hasAttribute(stack[i], this._attribute_name)) { new_tooltip_target = stack[i]; break; } } if (new_tooltip_target != this._tooltip_target) { ...
javascript
{ "resource": "" }
q34449
train
function(event_name, event_object) { this._tooltip.set('x', event_object.page.x); // left
javascript
{ "resource": "" }
q34450
train
function () { if (!this._focus_acquired_listener) { this._focus_acquired_listener = Lava.app.on('focus_acquired', this._onFocusTargetAcquired, this); this._focus_lost_listener = Lava.app.on('focus_lost', this.clearFocusedTarget, this); this._focus_listener =
javascript
{ "resource": "" }
q34451
train
function() { if (this._focus_acquired_listener) { Lava.app.removeListener(this._focus_acquired_listener); Lava.app.removeListener(this._focus_lost_listener);
javascript
{ "resource": "" }
q34452
train
function(event_name, event_object) { if (this._focused_element != event_object.target)
javascript
{ "resource": "" }
q34453
train
function(module, name, config, module_storage) { this._module = module; this._name = name; this._config = config; this._properties_by_guid = module_storage;
javascript
{ "resource": "" }
q34454
train
function(properties, raw_properties) { if (Lava.schema.data.VALIDATE_IMPORT_DATA && !this.isValidValue(raw_properties[this._name])) Lava.t('Invalid value in import data ('
javascript
{ "resource": "" }
q34455
train
function(record_a, record_b) { return this._properties_by_guid[record_a.guid][this._name]
javascript
{ "resource": "" }
q34456
train
function(field, event_args) { var local_record = event_args.collection_owner; if (local_record.guid in this._collections_by_record_guid) { Lava.suspendListener(this._collection_listeners_by_guid[local_record.guid].removed);
javascript
{ "resource": "" }
q34457
train
function(field, event_args) { var local_record = event_args.collection_owner; if (local_record.guid in this._collections_by_record_guid) { Lava.suspendListener(this._collection_listeners_by_guid[local_record.guid].added);
javascript
{ "resource": "" }
q34458
train
function(record, foreign_key) { if (foreign_key in this._collections_by_foreign_id) { this._collections_by_foreign_id[foreign_key].push(record); }
javascript
{ "resource": "" }
q34459
train
function(foreign_module_id_field, event_args) { var referenced_record = event_args.record, // record belongs to foreign module new_referenced_id = referenced_record.get('id'), collection, i = 0, count; if (referenced_record.guid in this._collections_by_foreign_guid) { collection = this._collection...
javascript
{ "resource": "" }
q34460
train
function(record, properties, referenced_record_id) { properties[this._name] = this._referenced_module.getRecordById(referenced_record_id) || null;
javascript
{ "resource": "" }
q34461
train
function(local_record, referenced_record) { if (!Firestorm.Array.exclude(this._collections_by_foreign_guid[referenced_record.guid], local_record)) Lava.t();
javascript
{ "resource": "" }
q34462
train
function(local_record, referenced_record) { var referenced_guid = referenced_record.guid; if (referenced_guid in this._collections_by_foreign_guid) { if (Lava.schema.DEBUG && this._collections_by_foreign_guid[referenced_guid].indexOf(local_record) != -1) Lava.t("Duplicate record"); this._collections_by...
javascript
{ "resource": "" }
q34463
train
function(record) { if (Lava.schema.DEBUG && !(record.guid in this._properties_by_guid)) Lava.t("isLess: record does not belong to this module"); var ref_record_a = this._properties_by_guid[record.guid][this._name]; //
javascript
{ "resource": "" }
q34464
train
function(config) { var field_name, type, constructor; for (field_name in config.fields) { type = config.fields[field_name].type || Lava.schema.data.DEFAULT_FIELD_TYPE; constructor = Lava.ClassManager.getConstructor(type, 'Lava.data.field');
javascript
{ "resource": "" }
q34465
train
function() { var default_properties = {}, field_name; for (field_name in this._fields) { this._fields[field_name].onModuleFieldsCreated(default_properties);
javascript
{ "resource": "" }
q34466
train
function(lava_app, config, name) { this._app = lava_app; this._config = config; this._name = name; this._createFields(config); this._record_constructor = Lava.ClassManager.getConstructor(
javascript
{ "resource": "" }
q34467
train
function(raw_properties) { var result; if (Lava.schema.DEBUG && !raw_properties.id) Lava.t('safeLoadRecord: import data must have an
javascript
{ "resource": "" }
q34468
train
function(raw_records_array) { var i = 0, count = raw_records_array.length, records = []; for (; i
javascript
{ "resource": "" }
q34469
train
function(module, fields, properties_ref, raw_properties) { this.guid = Lava.guid++; this._module = module; this._fields = fields; this._properties = properties_ref; var field; if (typeof(raw_properties) != 'undefined') { for (field in fields) {
javascript
{ "resource": "" }
q34470
train
function(config) { if ('id' in config.fields) Lava.t("Id field in MetaStorage is not permitted"); this._config = config; this._createFields(config); this.initFields(); // MetaStorage is constructed directly, not via App class
javascript
{ "resource": "" }
q34471
train
function(ext_guid, raw_properties, original_record) { if (ext_guid in this._properties) Lava.t("MetaRecord already exists"); var properties = this._createRecordProperties(), record = new this._record_constructor(this, this._fields,
javascript
{ "resource": "" }
q34472
train
function(property_name) { if (!(property_name in this._data_bindings_by_property)) { this._data_bindings_by_property[property_name]
javascript
{ "resource": "" }
q34473
train
function(path_config) { var widget = this._widget.locateViewByPathConfig(path_config); if (Lava.schema.DEBUG
javascript
{ "resource": "" }
q34474
train
function() { var result = null; // in production - wrap evaluation into try/catch block if (Lava.schema.DEBUG) { result = this._evaluator(); } else {
javascript
{ "resource": "" }
q34475
train
function(index, arguments_array) { return this._modifier_descriptors[index].widget.callModifier(this
javascript
{ "resource": "" }
q34476
train
function(config, widget) { this._widget = widget; this._property_name = config.property_name; this._scope = widget.getScopeByPathConfig(config.path_config); if (config.from_widget) { this._scope.setValue(this._widget.get(this._property_name)); } else { this._widget.set(this._property_name, this._sc...
javascript
{ "resource": "" }
q34477
train
function() { // avoid setting nulls to non-nullable fields. if (this._scope.isConnected()) { // turning off both of them to avoid infinite loop. From architect's point of view, better solution would be // to hang up developer's browser, but if it happens in production - it may have disastrous consequences. ...
javascript
{ "resource": "" }
q34478
train
function() { Lava.suspendListener(this._widget_property_changed_listener); this._scope_changed_listener && Lava.suspendListener(this._scope_changed_listener); this._scope.setValue(this._widget.get(this._property_name));
javascript
{ "resource": "" }
q34479
train
function(value_container, property_name) { this.guid = Lava.guid++; this._value_container = value_container; this._property_name = property_name; this.level = value_container.level + 1; this._container_changed_listener = value_container.on('changed',
javascript
{ "resource": "" }
q34480
train
function() { var property_container = this._value_container.getValue(), value = null, is_connected = false; if (property_container != null) { // Collection implements Properties, so if _property_name is not a number - then `get` will be called if (property_container.isCollection && /^\d+$/.test(this....
javascript
{ "resource": "" }
q34481
train
function() { if (this._property_changed_listener && (this._value_container.getValue() != this._property_container)) { // currently listening to the parent's old data source this._property_changed_listener && this._property_container.removePropertyListener(this._property_changed_listener); this._enumerable_...
javascript
{ "resource": "" }
q34482
train
function(value) { var property_container = this._value_container.getValue(); if (property_container) { if (this._property_changed_listener) { Lava.suspendListener(this._property_changed_listener); property_container.set(this._property_name, value); Lava.resumeListener(this._property_changed_liste...
javascript
{ "resource": "" }
q34483
train
function(argument, view, widget, config) { var i = 0, count, depends, bind; this.guid = Lava.guid++; this._argument = argument; this._view = view; this._widget = widget; this.level = argument.level + 1; if (config) { if (Lava.schema.DEBUG && ['Enumerable', 'DataView'].indexOf(config['own_e...
javascript
{ "resource": "" }
q34484
train
function() { var argument_value = this._argument.getValue(); if (argument_value) { this._refreshDataSource(argument_value); if (this._observable_listener == null) { if (argument_value.isCollection) { this._observable_listener = argument_value.on('collection_changed', this._onObservableChanged, ...
javascript
{ "resource": "" }
q34485
train
function(view, property_name, assign_config) { this.guid = Lava.guid++; this._view = view; this._property_name = property_name; if (assign_config) { this._assign_argument = new Lava.scope.Argument(assign_config, view, view.getWidget()); this._assign_argument.on('changed', this.onAssignChanged, this); ...
javascript
{ "resource": "" }
q34486
train
function(value) { Lava.suspendListener(this._property_changed_listener); this._view.set(this._property_name,
javascript
{ "resource": "" }
q34487
train
function(container, name_source_container) { if (Lava.schema.DEBUG && !name_source_container.isValueContainer) Lava.t(); if (Lava.schema.DEBUG && !name_source_container.guid) Lava.t("Name source for segments must be either PropertyBinding or DataBinding"); this._container = container; this._property_name = na...
javascript
{ "resource": "" }
q34488
train
function(view, config, widget) { // About IOS bugfixes: // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html // http://www.quirksmode.org/blog/archives/2010/10/click_event_del_1.html var needs_shim = Firestorm.Environment.platform ==
javascript
{ "resource": "" }
q34489
train
function(event_name, target) { if (this._is_inDOM && event_name == 'click' && !(event_name
javascript
{ "resource": "" }
q34490
train
function(event_name, target) { if (!(event_name in this._events)) { this._events[event_name] = [target];
javascript
{ "resource": "" }
q34491
train
function(name, value) { if (Lava.schema.DEBUG && name == 'id') Lava.t(); if (Lava.schema.DEBUG && (name in this._property_bindings)) Lava.t("Property is bound to an argument and
javascript
{ "resource": "" }
q34492
train
function(class_name, cancel_sync) { if (Lava.schema.DEBUG && (!class_name || class_name.indexOf(' ') != -1)) Lava.t("addClass: expected one class
javascript
{ "resource": "" }
q34493
train
function(class_name, cancel_sync) { if (Firestorm.Array.exclude(this._static_classes, class_name)) { if (this._is_inDOM &&
javascript
{ "resource": "" }
q34494
train
function(class_names, cancel_sync) { if (Lava.schema.DEBUG && typeof(class_names) == 'string') Lava.t(); for (var i = 0,
javascript
{ "resource": "" }
q34495
train
function(name, value, cancel_sync) { if (value == null) { this.removeStyle(name, cancel_sync); } else
javascript
{ "resource": "" }
q34496
train
function(name, cancel_sync) { if (name in this._static_styles) { delete this._static_styles[name];
javascript
{ "resource": "" }
q34497
train
function(configs, view, fn) { var result = {}, argument; for (var name in configs) { argument = new
javascript
{ "resource": "" }
q34498
train
function(argument, event_args, listener_args) { if (this._is_inDOM) { // note: escape will be handled by framework var value = argument.getValue(); if (value != null && value !== false)
javascript
{ "resource": "" }
q34499
train
function(argument, event_args, listener_args) { var value = this._style_bindings[listener_args.name].getValue() || '';
javascript
{ "resource": "" }