Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.emit(INTERNAL_EVENT, DOM_BEFORE_UNLOAD);
removeHandler(win, 'beforeunload', this.beforeUnloadHandler);
};
// Обработчик unload
this.unloadHandler = () => {
this.emit(INTERNAL_EVENT, DOM_UNLOAD);
removeHandler(win, 'unload', this.unloadHandler);
};
};
Emitter(BrowserEventsTracker.prototype);
BrowserEventsTracker.prototype.initialize = function () {
addHandler(win, 'load', this.loadedHandler);
addHandler(win, 'beforeunload', this.beforeUnloadHandler);
addHandler(win, 'unload', this.unloadHandler);
};
export default BrowserEventsTracker;
}
const url = window.location.origin
const socketConfig = {
path: '/api/events',
transports: ['websocket'],
autoConnect: false
}
const shootsSocketAuthenticator = new SocketAuthenticator(io(`${url}/shoots`, socketConfig))
const journalsSocketAuthenticator = new SocketAuthenticator(io(`${url}/journals`, socketConfig))
const shootsEmitter = Emitter(new ShootsSubscription(shootsSocketAuthenticator))
const shootEmitter = Emitter(new ShootSubscription(shootsSocketAuthenticator))
const journalIssuesEmitter = Emitter(new IssuesSubscription(journalsSocketAuthenticator))
const journalCommentsEmitter = Emitter(new CommentsSubscription(journalsSocketAuthenticator))
const socketAuthenticators = [shootsSocketAuthenticator, journalsSocketAuthenticator]
/* Web Socket Connection */
forEach(socketAuthenticators, emitter => {
emitter.socket.on('connect', attempt => emitter.onConnect(attempt))
emitter.socket.on('reconnect', attempt => emitter.onConnect(attempt))
emitter.socket.on('authenticated', () => emitter.onAuthenticated())
emitter.socket.on('disconnect', reason => emitter.onDisconnect(reason))
emitter.socket.on('connect_error', err => {
console.error(`socket connection error ${err}`)
})
emitter.socket.on('connect_timeout', () => {
console.error(`socket ${emitter.socket.id} connection timeout`)
})
return false
}
}
const url = window.location.origin
const socketConfig = {
path: '/api/events',
transports: ['websocket'],
autoConnect: false
}
const shootsSocketAuthenticator = new SocketAuthenticator(io(`${url}/shoots`, socketConfig))
const journalsSocketAuthenticator = new SocketAuthenticator(io(`${url}/journals`, socketConfig))
const shootsEmitter = Emitter(new ShootsSubscription(shootsSocketAuthenticator))
const shootEmitter = Emitter(new ShootSubscription(shootsSocketAuthenticator))
const journalIssuesEmitter = Emitter(new IssuesSubscription(journalsSocketAuthenticator))
const journalCommentsEmitter = Emitter(new CommentsSubscription(journalsSocketAuthenticator))
const socketAuthenticators = [shootsSocketAuthenticator, journalsSocketAuthenticator]
/* Web Socket Connection */
forEach(socketAuthenticators, emitter => {
emitter.socket.on('connect', attempt => emitter.onConnect(attempt))
emitter.socket.on('reconnect', attempt => emitter.onConnect(attempt))
emitter.socket.on('authenticated', () => emitter.onAuthenticated())
emitter.socket.on('disconnect', reason => emitter.onDisconnect(reason))
emitter.socket.on('connect_error', err => {
console.error(`socket connection error ${err}`)
})
emitter.socket.on('connect_timeout', () => {
this.pathPrefix = options.pathPrefix;
this.server = this.options.server;
this.wsServer = this.options.wsServer || this.options.server;
this.wsPath = this.options.wsPath || '/wss';
this.urlMark = this.options.urlMark;
this.wsConnected = false;
this.servicesMap = {
'track': 't4k'
}
this.msgCounter = new Date() - 1514764800000;
this.waitCallers = {};
};
// Extending Emitter
Emitter(Transport.prototype);
/**
* Set default credentials that used to send data to server
* @param {Object} creds object containing creds
* @returns {Transport}
*/
Transport.prototype.setCreds = function (creds) {
this.creds = objectAssign({}, creds);
return this;
}
/**
* Transform path to query url
* @param {string} path
import Emitter from 'component-emitter'
import on from './on'
import parsejson from './parsejson'
import bind from 'component-bind'
import parseuri from 'parseuri'
export default Engine
const GlobalEmitter = Emitter({ hasEmitte: false })
Emitter(Engine.prototype)
const packets = {
open: 0, // non-ws
close: 1, // non-ws
ping: 2,
pong: 3,
message: 4,
upgrade: 5,
noop: 6,
}
const packetslist = Object.keys(packets)
function Engine(uri, opts) {
test('rendering new elements should be batched with state changes', ({equal,end}) => {
var app = deku()
var el = div()
var renderer = render(app, el)
var mount = app.mount.bind(app)
var unmount = app.unmount.bind(app)
var emitter = new Emitter()
var i = 0
var ComponentA = {
initialState: function(){
return {
text: 'Deku Shield'
}
},
afterMount: function(component, el, updateState) {
emitter.on('data', text => updateState({ text: text }))
},
render: function({props,state}){
i++
return <div>{props.text} {state.text}</div>
}
}
this.reLookup[key] = rEdge
}
return rEdge
}
addVertexPoint (point) {
if (this.baseVertexPoints.indexOf(point) !== -1) return
this.baseVertexPoints.push(point)
}
}
/**
* Mixin `Emitter`
*/
Emitter(Network.prototype)
import Emitter from 'component-emitter'
import bind from 'component-bind'
import Backoff from 'backo2'
import indexOf from 'indexof'
import on from './on'
import Engine from './engine'
import { encoder, decoder } from './parser'
import Socket from './socket'
const has = Object.prototype.hasOwnProperty
Emitter(Manager.prototype)
export default Manager
function Manager(uri, opts) {
if (!(this instanceof Manager)) return new Manager(uri, opts)
opts.path = opts.path || 'socket.io'
this.nsps = {}
this.subs = []
this.opts = opts
this.uri = uri
this.readyState = 'closed'
this.connected = false
this.reconnection(opts.reconnection !== false)
this.reconnectionAttempts(opts.reconnectionAttempts || Infinity)
this.reconnectionDelay(opts.reconnectionDelay || 1000)
this.display.applyTransform(transform)
this.render()
}
/** editor functions **/
createVertex (wx, wy) {
this.network.graph.addVertex(new Point(), wx, wy)
}
}
/**
* Mixin `Emitter`
*/
Emitter(Transitive.prototype)
import Emitter from 'component-emitter'
import on from './on.js'
import bind from 'component-bind'
Emitter(Socket.prototype)
const parser = {
CONNECT: 0,
DISCONNECT: 1,
EVENT: 2,
ACK: 3,
ERROR: 4,
BINARY_EVENT: 5,
BINARY_ACK: 6,
}
const events = {
connect: 1,
connect_error: 1,
connect_timeout: 1,
connecting: 1,