Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
newListener='newListener'
}
export class CustomEventEmitter extends EventEmitter {
on (...args) {
if (args[0] !== ArianeListenerEvent.newListener) {
super.emit(ArianeListenerEvent.newListener, args[0]);
}
// @ts-ignore
return super.on(...args);
}
addListener=this.on;
}
@singleton()
export class ArianeeEventEmitter {
public EE = new CustomEventEmitter();
}
import { injectable } from 'tsyringe';
import * as operations from '../../shared/operations';
import RepeatRepository from '../repositories/RepeatRepository';
type Operation = operations.Operation;
@injectable()
export default class RepeatUseCase {
constructor(
private repeatRepository: RepeatRepository,
) {
}
storeLastOperation(op: Operation): void {
this.repeatRepository.setLastOperation(op);
}
getLastOperation(): operations.Operation | undefined {
return this.repeatRepository.getLastOperation();
}
// eslint-disable-next-line complexity
isRepeatable(op: Operation): boolean {
import DatatipAdapter from 'atom-languageclient/build/lib/adapters/datatip-adapter'
// tslint:disable-next-line: no-import-side-effect
import 'reflect-metadata'
import { container } from 'tsyringe'
import { GoDatatipAdapter } from './datatip-adapter'
import { GoLanguageClient } from './language-client'
const client: GoLanguageClient = container
.register(DatatipAdapter, {
useClass: GoDatatipAdapter,
})
.resolve(GoLanguageClient)
module.exports = client
type BrowserSettings = {
value: string;
levelOfControl: LevelOfControlType;
};
type LevelOfControlType =
'not_controllable' |
'controlled_by_other_extensions' |
'controllable_by_this_extension' |
'controlled_by_this_extension';
function get(param: object): Promise;
}
@injectable()
export default class BrowserSettingRepository {
async getHomepageUrls(): Promise {
const { value } = await browser.browserSettings.homepageOverride.get({});
return value.split('|').map(urls.normalizeUrl);
}
}
import 'reflect-metadata';
import Application from './Application';
import consoleFrameStyle from './site-style';
import { ConsoleFramePresenterImpl } from './presenters/ConsoleFramePresenter';
import { container } from 'tsyringe';
import './di';
if (window.self === window.top) {
new ConsoleFramePresenterImpl().initialize();
}
try {
const app = container.resolve(Application);
app.run();
} catch (e) { console.error(e); }
const style = window.document.createElement('style');
style.textContent = consoleFrameStyle;
window.document.head.appendChild(style);
import Keymaps from '../../shared/settings/Keymaps';
import Key from '../../shared/settings/Key';
import KeySequence from '../domains/KeySequence';
import AddressRepository from '../repositories/AddressRepository';
const reservedKeymaps = Keymaps.fromJSON({
'': { type: operations.CANCEL },
'': { type: operations.CANCEL },
});
const enableAddonOps = [
operations.ADDON_ENABLE,
operations.ADDON_TOGGLE_ENABLED,
];
@injectable()
export default class KeymapUseCase {
constructor(
@inject('KeymapRepository')
private repository: KeymapRepository,
@inject('SettingRepository')
private settingRepository: SettingRepository,
@inject('AddonEnabledRepository')
private addonEnabledRepository: AddonEnabledRepository,
@inject('AddressRepository')
private addressRepository: AddressRepository,
) {
}
import { injectable, singleton } from 'tsyringe';
@injectable()
export class WalletService {
public account;
public get publicKey (): string {
return this.account.address;
}
public get privateKey (): string {
return this.account.privateKey;
}
public bdhVaultURL:string;
public isBdhVault ():boolean {
return this.bdhVaultURL !== undefined;
}
import { injectable } from 'tsyringe';
import MarkUseCase from '../usecases/MarkUseCase';
@injectable()
export default class MarkController {
constructor(
private markUseCase: MarkUseCase,
) {
}
setGlobal(key: string, x: number, y: number): Promise {
return this.markUseCase.setGlobal(key, x, y);
}
jumpGlobal(key: string): Promise {
return this.markUseCase.jumpGlobal(key);
}
}
import { injectable } from 'tsyringe';
import * as operations from '../../shared/operations';
import FindUseCase from '../usecases/FindUseCase';
import ConsoleUseCase from '../usecases/ConsoleUseCase';
import TabUseCase from '../usecases/TabUseCase';
import TabSelectUseCase from '../usecases/TabSelectUseCase';
import ZoomUseCase from '../usecases/ZoomUseCase';
import NavigateUseCase from '../usecases/NavigateUseCase';
import RepeatUseCase from '../usecases/RepeatUseCase';
@injectable()
export default class OperationController {
constructor(
private findUseCase: FindUseCase,
private consoleUseCase: ConsoleUseCase,
private tabUseCase: TabUseCase,
private tabSelectUseCase: TabSelectUseCase,
private zoomUseCase: ZoomUseCase,
private navigateUseCase: NavigateUseCase,
private repeatUseCase: RepeatUseCase,
) {
}
async exec(count: number, op: operations.Operation): Promise {
await this.doOperation(count, op);
if (this.repeatUseCase.isRepeatable(op)) {
this.repeatUseCase.storeLastOperation(op);
import { injectable } from 'tsyringe';
import MemoryStorage from '../infrastructures/MemoryStorage';
const FIND_KEYWORD_KEY = 'find-keyword';
@injectable()
export default class FindRepository {
private cache: MemoryStorage;
constructor() {
this.cache = new MemoryStorage();
}
getKeyword(): Promise {
return Promise.resolve(this.cache.get(FIND_KEYWORD_KEY));
}
setKeyword(keyword: string): Promise {
this.cache.set(FIND_KEYWORD_KEY, keyword);
return Promise.resolve();
}
}