_fileReader.onload = function (){ var _url, _mimeType, _validMimeType, _validFileSize, $fileInfo; //, $source; //, _thumbnailURL; _url = _fileReader.result; _validMimeType = isValidMimeType(_file); _validFileSize = isValidFileSize(_file); _mimeType = _file.type === '' ? Mimer(_file.name) : _file.type; log.info(_file); if (_validMimeType && _validFileSize){ $fileInfo = $feedbackContainer.find('.file-info'); $fileInfo.find('#file-name').text(_file.name); $fileInfo.find('#file-size').text(humanReadable.fromBytes(_file.size)); $feedbackContainer.removeClass('has-progress has-message').addClass('has-file-info'); $submitBtn.removeAttr('disabled'); } else if (!_validMimeType){ $message.text('Invalid file type. Please select a video with a valid file type.'); $feedbackContainer.removeClass('has-progress has-file-info').addClass('has-message'); $submitBtn.attr('disabled', true); } else if (!_validFileSize){ $message.text('Invalid file size. Please select a smaller video.'); $feedbackContainer.removeClass('has-progress has-file-info').addClass('has-message'); $submitBtn.attr('disabled', true); } updateProgress($progress, 0); };
EnsInput.prototype.lookupEnsName = function (recipient) { const { ensResolution } = this.state log.info(`ENS attempting to resolve name: ${recipient}`) this.ens.lookup(recipient.trim()) .then((address) => { if (address === ZERO_ADDRESS) throw new Error(this.context.t('noAddressForName')) if (address !== ensResolution) { this.setState({ loadingEns: false, ensResolution: address, nickname: recipient.trim(), hoverText: address + '\n' + this.context.t('clickCopy'), ensFailure: false, }) } }) .catch((reason) => { log.error(reason) return this.setState({ loadingEns: false, ensResolution: ZERO_ADDRESS, ensFailure: true, hoverText: reason.message, }) }) }
// Handles project list from GitLab function __handle_list(gitlab_client, options, error, issues, issue_data) { const FN = '[' + NS + '.__handle_list' + ']'; try { if(error !== null) { log.error(FN, 'Could not list issues from GitLab'); } else { var existing_issue_id = null; var existing_issue_state = null; for(var i in issues) { if(issues[i].title == issue_data.title) { existing_issue_id = issues[i].id; existing_issue_state = issues[i].state; break; } } if(existing_issue_id !== null) { if(existing_issue_state !== 'opened') { __reopen(gitlab_client, options, existing_issue_id); } else { log.info(FN, 'Issue exists and is already opened, not re-opening'); } } else { __create(gitlab_client, options, issue_data); } } } catch(_e) { log.error(FN, _e); } }
return this.wrap(() => { log.info('Cast:', JSON.stringify(state, null, '\t')); return new Cast({ glance: this.newInstance(), logLevel: this.logLevel }).apply(state); });
var runCordovaApp = function (platform, callback) { log.info('Running cordova app for ' + platform + ' platform...'); var cordovaDir = path.join(process.cwd(), 'cordova'); try { process.chdir(cordovaDir); } catch (err) { log.error('ERROR: Failed to change the working directory to ' + cordovaDir); log.debug(err); return callback(new Error('Failed to run the Cordova app.')); } // path to cordova shell command var cordovaPath = path.resolve(__dirname, '..', 'node_modules', 'cordova', 'bin', 'cordova'); var cmdLine = cordovaPath + ' run ' + platform; log.debug(' ' + cmdLine); exec(cmdLine, function (err, stdout, stderr) { // set original working directory as current process.chdir(originalPath); log.debug(stdout); if (err) { log.debug(err); return callback(new Error('Failed to run the app for ' + platform + ' platform.')); } else if (stderr.length) { log.error(stderr.trim()); } log.info('The application was launched successfully!'); callback(); }); };
handleSubmit: async (values, {props}) => { log.info(`Register request for ${values.email}`) // TODO: Handle backend register errors await props.dispatch(registerUser(values)) await props.onRegister(props.dispatch) props.handleSwitchToLogin() }
/** * Creates sample features. * * @returns {Array} Created features. */ function createFeatures() { var created = []; var statuses = ['success', 'failure']; var runnerModels = createRunners(); var feature, status, reason, i; runnerModels.forEach(function(runner) { for (i = 0; i < NB_FEATURES; i++) { feature = { runner : {name: runner.attributes.name, runDate: runner.attributes.runDate}, description : _s.sprintf('Feature #%d', i + 1), status : statuses[Math.floor(Math.random() * statuses.length)] }; if (feature.status === 'failure') { feature.reason = { 'title' : _s.sprintf('Failure #%d', i + 1), 'help' : '<https://github.com/MattiSG/Watai/wiki/Troubleshooting>', 'source' : '- Something went wrong' }; } feature = features.create(feature); created.push(feature); } }); logger.info(_s.sprintf('Fixtures: created %d features', created.length)); return created; }
// Stats/debug/profiling methods // Profiling methods used to track when sets of tiles start/stop loading together // e.g. initial page load is one set of tiles, new sets of tile loads are then initiated by a map pan or zoom trackTileSetLoadStart() { // Start tracking new tile set if no other tiles already loading if (this.tile_set_loading == null) { this.tile_set_loading = +new Date(); log.info('Scene: tile set load start'); } }
exports.init = function(){ $(document).on('floodlight.track', function(e){ var $target = $(e.target), cat, fl; if ($target.attr('data-floodlight-cat')){ cat = $target.attr('data-floodlight-cat'); log.info(cat); fl = new Floodlight(cat); log.info(fl); fl.track($('#scratchpad')); } }); var selectors = [ '[data-control-action="begin-video"]', '[data-control-action="enter-sweepstakes"]', '[data-control-action="update-address"]', '[data-control-action="confirm"]', '[data-control-action="select-video-file"]', '[data-control-action="submit-video"]' ]; $(selectors.join(', ')).on('click', function (e){ var $target = $(e.target), evt; if ($target.attr('data-floodlight-cat')){ evt = $.extend(true, {}, e, { type: 'floodlight.track' }); log.info(evt); $(document).trigger(evt); } }); log.info('floodlight.js initialized'); };
}).catch(error => { this.initializing = false; this.updating = 0; // Report and revert to last valid config if available let type, message; if (error.name === 'YAMLException') { type = 'yaml'; message = 'Error parsing scene YAML'; } else { // TODO: more error types message = 'Error initializing scene'; } this.trigger('error', { type, message, error, url: this.config_source }); message = `Scene.load() failed to load ${this.config_source}: ${error.message}`; if (this.last_valid_config_source) { log.warn(message, error); log.info(`Scene.load() reverting to last valid configuration`); return this.load(this.last_valid_config_source, this.last_valid_config_path); } log.error(message, error); throw error; });
detail: function(teamSlug) { log.info('team:detail'); // fetch data var team = store.find('teams', {'slug': teamSlug}); if (!team) { return; } // views var viewOptions = { 'team': team, 'key': teamSlug }; var headerContextView = HeaderCreateDiscussion({ 'team_slug': teamSlug }); return dispatcher.small({ 'navLevel': 5, 'title': team.name, 'back': '/', 'main': TeamDetailView(viewOptions), 'headerContextView': headerContextView }).medium({ 'team': team, 'main': TeamDetailView(_.extend(viewOptions, {'loanimSelector': '.content-main'})) }).large({ 'team': team, 'list': TeamDetailView(_.extend(viewOptions, {'loanimSelector': '.list-main'})) }).render(); }
onWindowPostMessageReceived(e) { // Discard messages from unexpected origins; messages come frequently from other origins if (!this.isSafeOrigin(e.origin)) { log.debug(`(Postmam) Discarding message because ${e.origin} is not an allowed origin:`, e.data) return; } //console.log(`(Postmam) (${Environment.getEnv()}):`, e); let { id: messageId, command: messageCommand, data: messageData, source: messageSource } = e.data; if (messageCommand === Postmam.CONNECTED_MESSAGE) { this.emit('connect'); this.isConnected = true; return; } let messageBundle = { id: messageId, command: messageCommand, data: messageData, source: messageSource }; let messageBundleWithReply = objectAssign({ reply: this.reply.bind(this, messageBundle) }, messageBundle); if (this.replies.hasOwnProperty(messageId)) { log.info('(Postmam) This message is a reply.'); let replyFn = this.replies[messageId].bind(this.window); let replyFnReturnValue = replyFn(messageBundleWithReply); if (replyFnReturnValue === false) { delete this.replies[messageId]; } } else { this.emit(messageCommand, messageBundleWithReply); } }
var server = app.listen(cfenv.getAppEnv().port, function () { var host = server.address().address var port = server.address().port log.info('Example app listening at http://%s:%s', host, port) })
var sendDiscover = function() { log.info("Discovering Raumfeld devices"); self.ssdpClient.search('urn:schemas-upnp-org:device:MediaServer:1'); self.ssdpClient.search('urn:schemas-upnp-org:device:MediaRenderer:1'); if(updateInterval > 0) { setTimeout(sendDiscover, updateInterval); } }
return this.wrap(() => { log.info('Drag: "' + sourceSelector + '" and drop on "' + targetSelector + '"'); return Promise.all([ this.element(sourceSelector), this.element(targetSelector) ]) .then(result => this.browser.dragAndDrop(result[0], result[1], xOffset, yOffset)); });
$(selectors.join(', ')).on('click', function (e){ var $target = $(e.target), evt; if ($target.attr('data-floodlight-cat')){ evt = $.extend(true, {}, e, { type: 'floodlight.track' }); log.info(evt); $(document).trigger(evt); } });
next((/** @type {Function} */ cb) => { if (res.error) { log.error('Error in RPC response:\n', res) } if (req.isMetamaskInternal) return log.info(`RPC (${opts.origin}):`, req, '->', res) cb() })
this.addWaiter(id, function(existing) { if(!existing) { log.info('coll: Unable to find model ' + id); return; } self.applyUpdate('patch', existing, newModel, parsed); }, PATCH_TIMEOUT);
platformUtils.makeAppx(directory, outputPath, function (err) { if (err) { log.error('ERROR: ' + err.message); return; } log.info('The app store package was created successfully!'); });
app.get('*', function (req, res, next) { if (req.headers['x-forwarded-proto'] !== 'https' && process.env.NODE_ENV === 'production') { log.info('Redirecting request to HTTPS'); res.redirect('https://' + req.headers.host + req.url); } else { return next(); } });
projectBuilder.createApps(manifestInfo, rootDir, platforms, parameters.build, function (err) { if (err) { log.warn('WARNING: ' + err.message); return; } log.info('The application(s) are ready!'); });
var copyDocFile = function (docFilename, targetPath, callback) { var source = path.join(__dirname, '..', 'docs', docFilename); var target = path.join(targetPath, docFilename); log.info('Copying documentation file "' + docFilename + '" to target: ' + target + '...'); fileUtils.copyFile(source, target, callback); };
con.query('UPDATE maho_game.players SET topScore = ? WHERE guid = ?', [score, guid], function(err, result) { if(err) throw err; log.info('Update score complete. guid: ' + guid); res.send({ msgID: msgTypes.S_UPDATE_SCORE_RESPONSE, msgContent: 'Update score complete.'} ); });
return this.wrap(() => { log.info('Save:', selector); return this.newInstance({...this.config, retryCount: 0, logLevel: this.config.logLevel || 'error'}) .get(selector).then(result => { this.watchedSelectors[selector] = this.watchedSelectors[selector] || []; this.watchedSelectors[selector].unshift(result); return result; }); });
constructor (context = {}) { log.info('Beep', context) this.context = context this.duration = .0625 this.frequency = 256 this.volume = .75 this.output = this.context.destination this.play = this.play.bind(this) }
async function ({dispatch, getState}) { log.info('loadUser: Loading user data') const userInfo = await stuffrApi.getUserInfo() await dispatch(api.getInventories()) // Inventory list is populated by previous action // TODO: Last inventory is not being saved dispatch(loadInventory()) return userInfo },
PendingTx.prototype.gasLimitChanged = function (newBN, valid) { log.info(`Gas limit changed to ${newBN.toString(10)}`) const txMeta = this.gatherTxMeta() txMeta.txParams.gas = '0x' + newBN.toString('hex') this.setState({ txData: clone(txMeta), valid, }) }
}).then(() => { log.info('File uploaded successfully'); this.props.onChange({target: {value: true}}); this.setState({ uploading: false, progress: undefined, isEnabled: true, }); }).catch(() => {
events.on('app:quit', function() { log.info('App is quiting, cleanup avatars'); try { rimraf.sync(tempAvatarDirectory); } catch(err) { log.error('Something went wrong while cleaning up the avatars: ' + err.message + err.stack); } });
return this.wrap(() => { log.info('Get change:', selector); if (!this.watchedSelectors[selector] || this.watchedSelectors[selector].length === 0) { return Promise.reject('No saved value found. Please call "Save" for:', selector); } return Promise.resolve(this.watchedSelectors[selector]); });