Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor() {
Events.on('refresh', this.refresh.bind(this));
Events.on('set-filter', this.setFilter.bind(this));
Events.on('add-filter', this.addFilter.bind(this));
Events.on('set-sort', this.setSort.bind(this));
Events.on('empty-trash', this.emptyTrash.bind(this));
Events.on('select-entry', this.selectEntry.bind(this));
Events.on('unset-keyfile', this.unsetKeyFile.bind(this));
this.appLogger = new Logger('app');
AppModel.instance = this; // For KeeWebHttp. TODO: kill this
}
constructor() {
Events.on('refresh', this.refresh.bind(this));
Events.on('set-filter', this.setFilter.bind(this));
Events.on('add-filter', this.addFilter.bind(this));
Events.on('set-sort', this.setSort.bind(this));
Events.on('empty-trash', this.emptyTrash.bind(this));
Events.on('select-entry', this.selectEntry.bind(this));
Events.on('unset-keyfile', this.unsetKeyFile.bind(this));
this.appLogger = new Logger('app');
AppModel.instance = this; // For KeeWebHttp. TODO: kill this
}
constructor() {
Events.on('refresh', this.refresh.bind(this));
Events.on('set-filter', this.setFilter.bind(this));
Events.on('add-filter', this.addFilter.bind(this));
Events.on('set-sort', this.setSort.bind(this));
Events.on('empty-trash', this.emptyTrash.bind(this));
Events.on('select-entry', this.selectEntry.bind(this));
Events.on('unset-keyfile', this.unsetKeyFile.bind(this));
this.appLogger = new Logger('app');
AppModel.instance = this; // For KeeWebHttp. TODO: kill this
}
delete this.pendingFileToOpen;
}
},
openFile(file) {
if (this.readyToOpenFiles) {
Events.emit('launcher-open-file', file);
} else {
this.pendingFileToOpen = file;
}
},
setGlobalShortcuts(appSettings) {
this.remoteApp().setGlobalShortcuts(appSettings);
}
};
Events.on('launcher-exit-request', () => {
setTimeout(() => Launcher.exit(), 0);
});
Events.on('launcher-minimize', () => setTimeout(() => Events.emit('app-minimized'), 0));
Events.on('launcher-started-minimized', () => setTimeout(() => Launcher.minimizeApp(), 0));
window.launcherOpen = file => Launcher.openFile(file);
if (window.launcherOpenedFile) {
logger.info('Open file request', window.launcherOpenedFile);
Launcher.openFile(window.launcherOpenedFile);
delete window.launcherOpenedFile;
}
Events.on('app-ready', () => setTimeout(() => Launcher.checkOpenFiles(), 0));
global.Events = Events;
export { Launcher };
if (this.readyToOpenFiles) {
Events.emit('launcher-open-file', file);
} else {
this.pendingFileToOpen = file;
}
},
setGlobalShortcuts(appSettings) {
this.remoteApp().setGlobalShortcuts(appSettings);
}
};
Events.on('launcher-exit-request', () => {
setTimeout(() => Launcher.exit(), 0);
});
Events.on('launcher-minimize', () => setTimeout(() => Events.emit('app-minimized'), 0));
Events.on('launcher-started-minimized', () => setTimeout(() => Launcher.minimizeApp(), 0));
window.launcherOpen = file => Launcher.openFile(file);
if (window.launcherOpenedFile) {
logger.info('Open file request', window.launcherOpenedFile);
Launcher.openFile(window.launcherOpenedFile);
delete window.launcherOpenedFile;
}
Events.on('app-ready', () => setTimeout(() => Launcher.checkOpenFiles(), 0));
global.Events = Events;
export { Launcher };
init(appModel) {
if (!this.enabled) {
return;
}
this.appModel = appModel;
Events.on('auto-type', e => this.handleEvent(e));
Events.on('main-window-blur', e => this.resetPendingEvent(e));
Events.on('main-window-will-close', e => this.resetPendingEvent(e));
Events.on('closed-open-view', e => this.processPendingEvent(e));
},
Tip.prototype.show = function() {
if ((!Tip.enabled && !this.force) || !this.title) {
return;
}
Events.on('page-geometry', this.hide);
if (this.tipEl) {
this.tipEl.remove();
if (this.hideTimeout) {
clearTimeout(this.hideTimeout);
this.hideTimeout = null;
}
}
const tipEl = (this.tipEl = $('<div></div>')
.addClass('tip')
.appendTo('body')
.html(this.title));
const rect = this.el[0].getBoundingClientRect();
const tipRect = this.tipEl[0].getBoundingClientRect();
const placement = this.placement || this.getAutoPlacement(rect, tipRect);
tipEl.addClass('tip--' + placement);
if (this.fast) {
}
const token = this._oauthProcessReturn(e.data);
if (token) {
Events.off('popup-closed', popupClosed);
window.removeEventListener('message', windowMessage);
if (token.error) {
this.logger.error('OAuth error', token.error, token.errorDescription);
callback('OAuth: ' + token.error);
} else {
callback();
}
} else {
this.logger.debug('Skipped OAuth message', e.data);
}
};
Events.on('popup-closed', popupClosed);
window.addEventListener('message', windowMessage);
}
this.input = $(document.createElement(this.model.multiline ? 'textarea' : 'input'));
this.valueEl.html('').append(this.input);
this.input
.attr({ autocomplete: 'off', spellcheck: 'false' })
.val(text)
.focus()[0]
.setSelectionRange(text.length, text.length);
this.input.bind({
input: this.fieldValueInput.bind(this),
keydown: this.fieldValueKeydown.bind(this),
keypress: this.fieldValueInput.bind(this),
click: this.fieldValueInputClick.bind(this),
mousedown: this.fieldValueInputMouseDown.bind(this)
});
const fieldValueBlurBound = e => this.fieldValueBlur(e);
Events.on('click', fieldValueBlurBound);
this.stopBlurListener = () => Events.off('click', fieldValueBlurBound);
this.listenTo(Events, 'main-window-will-close', this.externalEndEdit);
this.listenTo(Events, 'user-idle', this.externalEndEdit);
if (this.model.multiline) {
this.setInputHeight();
}
if (Features.isMobile) {
this.createMobileControls();
}
if (this.model.canGen) {
$('<div>')
.addClass('details__field-value-btn details__field-value-btn-gen')
.appendTo(this.valueEl)
.click(this.showGeneratorClick.bind(this))
.mousedown(this.showGenerator.bind(this));
}</div>