Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then((secret) => {
// 输出密码,到页面上。
self.setState({ registerResult: secret });
logger.debug('register successfully, secret: ', secret);
})
.catch((err) => {
render(templateVar) {
log.debug('render');
// filter current local directory files
if (templateVar.localFiles && templateVar.localFiles.length > 0) {
const tmpLocalFiles = templateVar.localFiles.filter(dir => {
return dir.path === templateVar.localCurDir;
})[0];
if (tmpLocalFiles && tmpLocalFiles.files) {
tmpLocalFiles.files.forEach((file, index, array) => {
if (file.modification && (file.modification instanceof Date)) {
array[index].modification = dateFormat.format(file.modification, 'yyyy/MM/dd');
}
});
templateVar.localFiles = tmpLocalFiles.files;
}
}
// filter current FlashAir directory files
if (templateVar.remoteFiles && templateVar.remoteFiles.length > 0) {
updatecontainerWidthAndHeight() {
// wrapped in try catch as in a global error case this.siteContent ref is not set
try {
const containerWidthInner =
this.siteContent.clientWidth -
(this.props.visibilitySettings.showMovielist ? 350 : 0) -
(this.props.visibilitySettings.showSettings ? 350 : 0) -
(this.props.file ? 0 : 700); // for startup
const containerHeightInner = this.siteContent.clientHeight -
(this.props.file ? 0 : 100); // for startup
if ((Math.abs(this.state.containerHeight - containerHeightInner) > 10) ||
(Math.abs(this.state.containerWidth - containerWidthInner) > 10)) {
log.debug(`new container size: ${containerWidthInner}x${containerHeightInner}`);
this.setState({
containerHeight: containerHeightInner,
containerWidth: containerWidthInner
}, () => this.updateScaleValue());
}
return true;
} catch (e) {
log.error(e);
return undefined;
}
}
appMain.store.on(AppEvent.REQUEST_REMOTE_FILE_LIST, state => {
log.debug(AppEvent.REQUEST_REMOTE_FILE_LIST);
// Show spinner for fetching FlashAir file list
this.render(Object.assign(this.baseTemplateVar, state));
});
appMain.store.on(AppEvent.REQUEST_REMOTE_FILE_LIST_FAILURE, state => {
private log(logLevel: LogLevel, message: string, data: any[] = []): void {
if (data && data.length > 0) {
data.forEach((param) => {
message += `, '${param && typeof param}': ${JSON.stringify(param)}`;
});
}
if (!isElectronQA) {
switch (logLevel) {
case 'error': electronLog.error(message); break;
case 'warn': electronLog.warn(message); break;
case 'info': electronLog.info(message); break;
case 'verbose': electronLog.verbose(message); break;
case 'debug': electronLog.debug(message); break;
case 'silly': electronLog.silly(message); break;
default: electronLog.info(message);
}
}
this.sendToCloud(this.formatLogMsg(logLevel, message));
}
.then((client) => {
logger.debug('start to enroll, request: ', req);
return client.enroll(req);
})
.then((enrollment) => {
this.debug = function debug() {
_logger.debug(arguments);
};
onDeviceAdded(adbKitDevice) {
let device = this.getDevice(adbKitDevice);
Object.assign(device, adbKitDevice);
device.onConnect();
log.debug('Device added: ' + device.id);
this.dispatch(actions.deviceAdded(device));
//ipcRenderer.send('adbkit-update-device-features', device);
ipcRenderer.send('adbkit-update-device', device);
}
if (key in this.settings) {
return this.settings[key];
}
const sql = `SELECT value
FROM settings
WHERE key = ?
AND metadata = FALSE`;
let value = await Database.db.one(sql, [key]);
if (value === undefined) {
value = null;
} else {
value = value['value'];
}
this.settings[key] = value;
log.debug(`Fetched setting ${key} with value ${value}`);
return value;
}
response_received(event, response) {
log.info(`RPC[${response.id}] response`);
log.debug(`RPC[${response.id}] <- response`, response);
var handler = this._pending[response.id];
delete this._pending[response.id];
if (response.error) {
handler.reject(response.error);
} else {
handler.resolve(response.result);
}
}
}