Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor() {
super('pubsub');
this._mountToCore = true;
// all pubsub messages from redis are routed through this emitter
// so we can send them to the correct handlers
this._router = new EventEmitter();
}
reconnectattempts: number,
reconnectdelay: number
}`, errors))
throw new Error(`invalid options: ${errors.join("; ")}`)
/* initialize state variables */
this._ws = null
this._wsf = null
this._to = null
this._tx = {}
/* provide hook latching sub-system */
this._latching = new Latching()
/* provide event emitter sub-system */
this._emitter = new EventEmitter()
}
cloneAnimator = (animator: React.Element<*>, index: number) => {
const events = new EventEmitter();
return React.cloneElement(animator, {
...(this.state.propertiesToAppend || {}),
// eslint-disable-next-line react/no-array-index-key
key: index,
ref: ref => {
this.animators[index] = {
ref,
events,
};
if (animator.ref) {
animator.ref(ref);
}
},
onFinish: ({ finished }) => {
if (animator.props.onFinish) {
animator.props.onFinish({ finished });
import WebSocket from '@core/webSocket';
import EventEmitter from 'eventemitter3';
import { callWithCallback } from '../util';
const bus = new EventEmitter();
const events = [ 'onOpen', 'onError', 'onMessage', 'onClose' ];
let instanceId = 0;
let opened = false;
export function connectSocket(options) {
if (opened) {
WebSocket.close({ instanceId });
opened = false;
instanceId++;
}
WebSocket.webSocket({
instanceId: instanceId,
url: options.url,
protocol: ''
}, res => {
beforeEach(() => {
state = {
emitter: new EventEmitter(),
l
};
});
createEvents() {
this.events = new EventEmitter()
this.events.on('onItemSelect', this.handleOptionSelect)
this.events.on('onItemFocus', this.handleOptionFocus)
this.events.on('onItemMount', this.addItem)
this.events.on('onItemUnmount', this.removeItem)
}
private constructor(
private readonly publicExtendedKey: string,
private readonly privateKeyGetter: PrivateKeysGetter,
private readonly messagingService: CFCoreTypes.IMessagingService,
private readonly storeService: CFCoreTypes.IStoreService,
private readonly nodeConfig: NodeConfig,
private readonly provider: BaseProvider,
public readonly networkContext: NetworkContext,
public readonly blocksNeededForConfirmation: number = REASONABLE_NUM_BLOCKS_TO_WAIT,
private readonly lockService?: CFCoreTypes.ILockService
) {
this.networkContext.provider = this.provider;
this.incoming = new EventEmitter();
this.outgoing = new EventEmitter();
this.protocolRunner = this.buildProtocolRunner();
log.info(
`Waiting for ${this.blocksNeededForConfirmation} block confirmations`
);
}
export function makeEventsEmitter(): InternalEventsEmitter {
return new EventEmitter() as InternalEventsEmitter;
}
constructor(props) {
super(props)
this.state = {
isDropdownOpened: false
}
this.events = new EventEmitter()
/**
* Упорядоченный массив с зарегестрированными компонентами SuggestItem
* @type {Array}
*/
this.sortedSuggestItems = []
/**
* Объект с сохраненными suggestItems
*/
this.suggestItems = {}
/**
* Текущий подсвеченный элемент
*/
this.highlightedSuggestItemId = null
}
constructor(options: ConstructorOptions) {
this._eventEmitter = new EventEmitter();
options.websocket.onmessage = this._onMessage.bind(this);
this._websocket = options.websocket;
}