onCourseComplete: function() { if (Adapt.course.get('_isComplete') === true) { this.set('_attempts', this.get('_attempts') + 1); } _.defer(_.bind(this.checkIfCourseIsReallyComplete, this)); },
_.defer(() => { // start time // var start = new Date().getTime() // reset the 3d transform this._clear3d() // redraw the svg this.zoomedSel .attr('transform', 'translate(' + translate.x + ',' + translate.y + ') ' + 'scale(' + scale + ')') // save svg location this._svgScale = scale this._svgTranslate = translate _.defer(() => { // defer for callback after draw this.callbackManager.run('svg_finish') if (!_.isUndefined(callback)) callback() // wait a few ms to get a reliable end time // _.delay(function () { // // end time // var t = new Date().getTime() - start // this._lastSvgMs = t // }.bind(this), 20) }) })
loadTransformationOverview: function(bucketId, transformationId, showDisabled) { return _.defer(function() { var tableId; dispatcher.handleViewAction({ type: constants.ActionTypes.TRANSFORMATION_OVERVIEW_LOAD, transformationId: transformationId, bucketId: bucketId }); tableId = bucketId + '.' + transformationId; return transformationsApi.getGraph({ tableId: tableId, direction: 'around', showDisabled: showDisabled, limit: { sys: [bucketId] } }).then(function(graphData) { dispatcher.handleViewAction({ type: constants.ActionTypes.TRANSFORMATION_OVERVIEW_LOAD_SUCCESS, transformationId: transformationId, bucketId: bucketId, model: graphData }); }).catch(function(error) { dispatcher.handleViewAction({ type: constants.ActionTypes.TRANSFORMATION_OVERVIEW_LOAD_ERROR, transformationId: transformationId, bucketId: bucketId }); throw error; }); }); },
/** * Runs passed builder * * @param {jQuery.Deferred} built * @param {Object} options * @param {Object} builder */ function runBuilder(built, options, builder) { if (!_.has(builder, 'init') || !$.isFunction(builder.init)) { built.resolve(); throw new TypeError('Builder does not have init method'); } _.defer(_.bind(builder.init, builder), built, options); }
resp.on("end",function(){ index_assets[asset.path] = { data: data }; for(var i in resp.headers){ /content-type/i.test(i) && (index_assets[asset.path].mime = resp.headers[i]); } _.defer(get_asset); });
_.each(files, function(file) { _.defer(function() { // Get file data: var data = fs.readFileSync('../historical/' + file, 'utf-8'); var json = JSON.parse(data); // Update disclaimer: json.disclaimer = "This data is collected from various providers and provided free of charge for informational purposes only, with no guarantee whatsoever of accuracy, validity, availability or fitness for any purpose; use at your own risk. Other than that - have fun, and please share/watch/fork if you think data like this should be free!"; // Update license: json.license = "Data collected from various providers with public-facing APIs; copyright may apply; not for resale; no warranties given."; // Make sure the base currency is also in the rates object, eg. `USD: 1` json.rates[json.base] = 1; // Sort rates by key and parse float values to remove zero-padding: json.rates = _.reduce(sortArrayByKey(json.rates), function(obj, val, key) { obj[key] = parseFloat("" + val); return obj; }, {}); // Write file contents: fs.writeFileSync('../historical/' + file, JSON.stringify(json, false, "\t") + "\n"); console.log(file); }); });
'init_instance_callback': function(editor) { self.removeSubview('loadingMask'); self.tinymceInstance = editor; if (!tools.isMobile()) { self.tinymceInstance.on('FullscreenStateChanged', function(e) { if (e.state) { var rect = $('#container').get(0).getBoundingClientRect(); var css = { top: rect.top + 'px', left: rect.left + 'px', right: Math.max(window.innerWidth - rect.right, 0) + 'px' }; var rules = _.map(_.pairs(css), function(item) { return item.join(': '); }).join('; '); tools.addCSSRule('div.mce-container.mce-fullscreen', rules); self.$el.after($('<div />', {class: 'mce-fullscreen-overlay'})); } else { self.$el.siblings('.mce-fullscreen-overlay').remove(); } }); } _.defer(function() { /** * fixes jumping dialog on refresh page * (promise should be resolved in a separate process) */ self._resolveDeferredRender(); }); }
destroy: function(options) { options = options ? _.clone(options) : {}; var model = this; var success = options.success; var wait = false; var destroy = function() { model.stopListening(); model.trigger('destroy', model, model.collection, options); }; options.success = function(resp) { if (wait) destroy(); if (success) success.call(options.context, model, resp, options); if (!model.isNew()) model.trigger('sync', model, resp, options); }; var xhr = false; if (this.isNew()) { _.defer(options.success); } else { wrapError(this, options); // xhr = this.sync('delete', this, options); } if (!wait) destroy(); return xhr; },
onPageRendered: function(cb) { if (document.pageReady) { _.defer(cb); } else { pageRenderedCbPool.push(cb); } },
function scheduleLoadingStateEntry(router) { if (router._loadingStateActive) { return; } router._shouldEnterLoadingState = true; // Ember.run.scheduleOnce('routerTransitions', null, enterLoadingState, router); _.defer(function () { enterLoadingState(router); }); }
render: function() { this.$el.html(this.template(null, { data: this.get_intl_data() })); this.load_content(this.collection, this.get_translation("drop_files_text")); this.update_count(); _.defer(this.create_dropzone, 1); },
render: function() { this.$el.append(template({doTaxonTiles: DO_TAXON_TILES})); DO_TAXON_TILES && _.defer(makeTreeMap); // showRecentActivity(this); return this; },
it("should defer invoking the function until the current call stack has cleared", function(done) { var a = 0; _.defer(function() { assert.strictEqual(a, 1000); done(); }); for (; a < 1000; a++); });
_.delay(function() { if (async) { _.defer(function() { queue_rl.shift().call(); }); } else { queue_rl.shift().call(); } emptyQueue(); }, rate);
render: function() { if (!this.log_model.get("highest_page")) { this.log_model.set("highest_page", 0); } this.$el.html(this.template(this.data_model.attributes)); this.initialize_listeners(); _.defer(this.render_pdf); },
update: function (id, data, params, cb) { _.defer(function () { cb(null, { id: id, name: data.name }); }, 20); }
Tool.prototype.onCompilerClose = function (id) { if (id === this.compilerId) { this.close(); _.defer(function (self) { self.container.close(); }, this); } };
_dragStart: function(e){ this.draggingConfiguration(this, e); var action = this.draggingStarted; _.defer(function(sender, $el){ action(sender, $el); }, this, $(e.currentTarget)); },
create: function (data, params, cb) { _.defer(function () { cb(null, { id: 10, name: data.name }); }); }
Ast.prototype.onCompilerClose = function (id) { if (id === this._compilerid) { // We can't immediately close as an outer loop somewhere in GoldenLayout is iterating over // the hierarchy. We can't modify while it's being iterated over. _.defer(function (self) { self.container.close(); }, this); } };
_renderShadows: function () { this.$shadowTop = $('<div>').addClass('CDB-Legends-canvasShadow CDB-Legends-canvasShadow--top'); this.$shadowBottom = $('<div>').addClass('CDB-Legends-canvasShadow CDB-Legends-canvasShadow--bottom'); this.$el.append(this.$shadowTop); this.$el.append(this.$shadowBottom); _.defer(function () { this._showOrHideShadows(); }.bind(this)); },
onFocusout: function(e) { if (!this._currencySelectionIsOpen && !this._isSelection) { _.defer(_.bind(function() { if (!this.disposed && !$.contains(this.el, document.activeElement)) { MultiCurrencyEditorView.__super__.onFocusout.apply(this, arguments); } }, this)); } },
render: function() { $('<div>').appendTo(this.el).slider(); _.defer(function() { this.$el.closest('.ui-dialog') .on("dialogresizestart", this.startResizing.bind(this)) .on("dialogresizestop", this.stopResizing.bind(this)); }.bind(this)); return this; },
componentDidUpdate: function () { if ((this.props.selectionComplete && !this.state.displayResult) || (!this.props.selectionComplete && this.state.displayResult)) { _.defer(function () { this.setState({ displayResult: this.props.selectionComplete }) }.bind(this)); } },
closeGroupStudents : function() { var modalRegion = pageChannel.request('modalRegion'); _.defer(function() { modalRegion.empty(); }); $('.modal-content').hide(); //this.$el.data('modal', null); //this.remove(); },
deployMutex._jobMonitor.on('resume', function() { _.defer(function() { assert.isAbove(new Date().getTime() - startTime, JobMonitor._monitorTimePeriod); assert.equal(chat.send.callCount, 2); var secondCall = chat.send.getCall(1); assert.include(secondCall.args[0], 'Continue'); done(); }); });
beforeEach(function () { var d1 = Hoard.defer(); var d2 = Hoard.defer(); _.defer(function () { this.m1Promise = this.m1.fetch(); d1.resolve(); }.bind(this)); _.defer(function () { this.m2Promise = this.m2.fetch(); d2.resolve(); }.bind(this)); return Promise.all([d1.promise, d2.promise]).then(function () { return Promise.all([this.m1Promise, this.m2Promise]); }.bind(this)); });
function onMarkerMoved() { // User moved tree for the first time (or clicked the map). Let them edit fields. enableFormFields(true); _.defer(function () { $editControls.not('[type="hidden"]').first().focus().select(); }); $placeMarkerMessage.hide(); $moveMarkerMessage.hide(); }
var MySQLStore = function(options, connection, cb) { debug.log('Creating session store'); if (_.isFunction(connection)) { cb = connection; connection = null; } var defaultOptions = { // How frequently expired sessions will be cleared; milliseconds: checkExpirationInterval: 900000, // The maximum age of a valid session; milliseconds: expiration: 86400000, // Whether or not to create the sessions database table, if one does not already exist: createDatabaseTable: true, // Number of connections when creating a connection pool: connectionLimit: 1, // Whether or not to end the database connection when the store is closed: endConnectionOnClose: !connection, charset: 'utf8mb4_bin', schema: { tableName: 'sessions', columnNames: { session_id: 'session_id', expires: 'expires', data: 'data' } } }; this.options = _.defaults(options || {}, defaultOptions); this.options.schema = _.defaults(this.options.schema, defaultOptions.schema); this.options.schema.columnNames = _.defaults(this.options.schema.columnNames, defaultOptions.schema.columnNames); if (this.options.debug) { deprecate('The \'debug\' option has been removed. This module now uses the debug module to output logs and error messages. Run your app with `DEBUG=express-mysql-session* node your-app.js` to have all logs and errors outputted to the console.'); } this.connection = connection || mysql.createPool(this.options); var done = function() { this.setExpirationInterval(); if (cb) { cb.apply(undefined, arguments); } }.bind(this); if (this.options.createDatabaseTable) { this.createDatabaseTable(done); } else { _.defer(done); } };
select_preview:function(event){ // called internally var selected_preview = _.find(this.model.get('files'), function(file){return file.preset.id === event.target.getAttribute('value');}); this.current_preview = selected_preview; this.render_preview(); var self = this; _.defer(function() { self.$("iframe").prop("src", function(){return $(this).data("src");}); }); },