New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

opentok-accelerator-core

Package Overview
Dependencies
Maintainers
2
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentok-accelerator-core - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

60

browser/opentok-acc-core.js

@@ -88,8 +88,20 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

return new Promise(function (resolve, reject) {
createPublisher().then(function (publisher) {
state.addPublisher('camera', publisher);
session.publish(publisher);
logging.log(logging.logAction.startCall, logging.logVariation.success);
resolve(publisher);
}).catch(function (error) {
var onPublish = function onPublish(publisher) {
return function (error) {
if (error) {
reject(error);
logging.log(logging.logAction.startCall, logging.logVariation.fail);
} else {
logging.log(logging.logAction.startCall, logging.logVariation.success);
state.addPublisher('camera', publisher);
resolve(publisher);
}
};
};
var publishToSession = function publishToSession(publisher) {
return session.publish(publisher, onPublish(publisher));
};
var handleError = function handleError(error) {
logging.log(logging.logAction.startCall, logging.logVariation.fail);

@@ -99,3 +111,5 @@ var errorMessage = error.code === 1010 ? 'Check your network connection' : error.message;

reject(error);
});
};
createPublisher().then(publishToSession).catch(handleError);
});

@@ -214,3 +228,8 @@ };

return new Promise(function (resolve, reject) {
// eslint-disable-line consistent-return
logging.log(logging.logAction.startCall, logging.logVariation.attempt);
/**
* Determine if we're able to join the session based on an existing connection limit
*/
if (!ableToJoin()) {

@@ -223,3 +242,7 @@ var errorMessage = 'Session has reached its connection limit';

publish().then(function (publisher) {
/**
* Subscribe to any streams that existed before we start the call from our side.
*/
var subscribeToInitialStreams = function subscribeToInitialStreams(publisher) {
// Get an array of initial subscription promises
var initialSubscriptions = function initialSubscriptions() {

@@ -240,3 +263,5 @@ if (autoSubscribe) {

};
Promise.all(initialSubscriptions()).then(function () {
// Handle success
var onSubscribeToAll = function onSubscribeToAll() {
var pubSubData = Object.assign({}, state.getPubSub(), { publisher: publisher });

@@ -246,6 +271,15 @@ triggerEvent('startCall', pubSubData);

resolve(pubSubData);
}).catch(function (reason) {
return logging.message('Failed to subscribe to all existing streams: ' + reason);
});
});
};
// Handle error
var onError = function onError(reason) {
logging.message('Failed to subscribe to all existing streams: ' + reason);
// We do not reject here in case we still successfully publish to the session
resolve(Object.assign({}, state.getPubSub(), { publisher: publisher }));
};
Promise.all(initialSubscriptions()).then(onSubscribeToAll).catch(onError);
};
publish().then(subscribeToInitialStreams).catch(reject);
});

@@ -252,0 +286,0 @@ };

@@ -85,8 +85,20 @@ 'use strict';

return new Promise(function (resolve, reject) {
createPublisher().then(function (publisher) {
state.addPublisher('camera', publisher);
session.publish(publisher);
logging.log(logging.logAction.startCall, logging.logVariation.success);
resolve(publisher);
}).catch(function (error) {
var onPublish = function onPublish(publisher) {
return function (error) {
if (error) {
reject(error);
logging.log(logging.logAction.startCall, logging.logVariation.fail);
} else {
logging.log(logging.logAction.startCall, logging.logVariation.success);
state.addPublisher('camera', publisher);
resolve(publisher);
}
};
};
var publishToSession = function publishToSession(publisher) {
return session.publish(publisher, onPublish(publisher));
};
var handleError = function handleError(error) {
logging.log(logging.logAction.startCall, logging.logVariation.fail);

@@ -96,3 +108,5 @@ var errorMessage = error.code === 1010 ? 'Check your network connection' : error.message;

reject(error);
});
};
createPublisher().then(publishToSession).catch(handleError);
});

@@ -211,3 +225,8 @@ };

return new Promise(function (resolve, reject) {
// eslint-disable-line consistent-return
logging.log(logging.logAction.startCall, logging.logVariation.attempt);
/**
* Determine if we're able to join the session based on an existing connection limit
*/
if (!ableToJoin()) {

@@ -220,3 +239,7 @@ var errorMessage = 'Session has reached its connection limit';

publish().then(function (publisher) {
/**
* Subscribe to any streams that existed before we start the call from our side.
*/
var subscribeToInitialStreams = function subscribeToInitialStreams(publisher) {
// Get an array of initial subscription promises
var initialSubscriptions = function initialSubscriptions() {

@@ -237,3 +260,5 @@ if (autoSubscribe) {

};
Promise.all(initialSubscriptions()).then(function () {
// Handle success
var onSubscribeToAll = function onSubscribeToAll() {
var pubSubData = Object.assign({}, state.getPubSub(), { publisher: publisher });

@@ -243,6 +268,15 @@ triggerEvent('startCall', pubSubData);

resolve(pubSubData);
}).catch(function (reason) {
return logging.message('Failed to subscribe to all existing streams: ' + reason);
});
});
};
// Handle error
var onError = function onError(reason) {
logging.message('Failed to subscribe to all existing streams: ' + reason);
// We do not reject here in case we still successfully publish to the session
resolve(Object.assign({}, state.getPubSub(), { publisher: publisher }));
};
Promise.all(initialSubscriptions()).then(onSubscribeToAll).catch(onError);
};
publish().then(subscribeToInitialStreams).catch(reject);
});

@@ -249,0 +283,0 @@ };

{
"name": "opentok-accelerator-core",
"version": "0.0.16",
"version": "0.0.17",
"description": "Opentok Accelerator Core",

@@ -28,11 +28,12 @@ "repository": "https://github.com/opentok/accelerator-core-js",

"browserify": "^13.1.1",
"eslint": "^3.5.0",
"eslint-config-airbnb": "^11.2.0",
"eslint-plugin-import": "^1.15.0",
"eslint-plugin-jsx-a11y": "^2.2.2",
"eslint-plugin-react": "^6.2.2"
"eslint": "^3.14.1",
"eslint-config-airbnb": "^14.0.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^3.0.2",
"eslint-plugin-react": "^6.9.0"
},
"dependencies": {
"eslint-plugin-import": "^1.16.0",
"opentok-solutions-logging": "^1.0.7"
}
}

@@ -85,8 +85,20 @@ 'use strict';

return new Promise(function (resolve, reject) {
createPublisher().then(function (publisher) {
state.addPublisher('camera', publisher);
session.publish(publisher);
logging.log(logging.logAction.startCall, logging.logVariation.success);
resolve(publisher);
}).catch(function (error) {
var onPublish = function onPublish(publisher) {
return function (error) {
if (error) {
reject(error);
logging.log(logging.logAction.startCall, logging.logVariation.fail);
} else {
logging.log(logging.logAction.startCall, logging.logVariation.success);
state.addPublisher('camera', publisher);
resolve(publisher);
}
};
};
var publishToSession = function publishToSession(publisher) {
return session.publish(publisher, onPublish(publisher));
};
var handleError = function handleError(error) {
logging.log(logging.logAction.startCall, logging.logVariation.fail);

@@ -96,3 +108,5 @@ var errorMessage = error.code === 1010 ? 'Check your network connection' : error.message;

reject(error);
});
};
createPublisher().then(publishToSession).catch(handleError);
});

@@ -211,3 +225,8 @@ };

return new Promise(function (resolve, reject) {
// eslint-disable-line consistent-return
logging.log(logging.logAction.startCall, logging.logVariation.attempt);
/**
* Determine if we're able to join the session based on an existing connection limit
*/
if (!ableToJoin()) {

@@ -220,3 +239,7 @@ var errorMessage = 'Session has reached its connection limit';

publish().then(function (publisher) {
/**
* Subscribe to any streams that existed before we start the call from our side.
*/
var subscribeToInitialStreams = function subscribeToInitialStreams(publisher) {
// Get an array of initial subscription promises
var initialSubscriptions = function initialSubscriptions() {

@@ -237,3 +260,5 @@ if (autoSubscribe) {

};
Promise.all(initialSubscriptions()).then(function () {
// Handle success
var onSubscribeToAll = function onSubscribeToAll() {
var pubSubData = Object.assign({}, state.getPubSub(), { publisher: publisher });

@@ -243,6 +268,15 @@ triggerEvent('startCall', pubSubData);

resolve(pubSubData);
}).catch(function (reason) {
return logging.message('Failed to subscribe to all existing streams: ' + reason);
});
});
};
// Handle error
var onError = function onError(reason) {
logging.message('Failed to subscribe to all existing streams: ' + reason);
// We do not reject here in case we still successfully publish to the session
resolve(Object.assign({}, state.getPubSub(), { publisher: publisher }));
};
Promise.all(initialSubscriptions()).then(onSubscribeToAll).catch(onError);
};
publish().then(subscribeToInitialStreams).catch(reject);
});

@@ -249,0 +283,0 @@ };

@@ -73,15 +73,25 @@ /* global OT */

new Promise((resolve, reject) => {
createPublisher()
.then((publisher) => {
const onPublish = publisher => (error) => {
if (error) {
reject(error);
logging.log(logging.logAction.startCall, logging.logVariation.fail);
} else {
logging.log(logging.logAction.startCall, logging.logVariation.success);
state.addPublisher('camera', publisher);
session.publish(publisher);
logging.log(logging.logAction.startCall, logging.logVariation.success);
resolve(publisher);
})
.catch((error) => {
logging.log(logging.logAction.startCall, logging.logVariation.fail);
const errorMessage = error.code === 1010 ? 'Check your network connection' : error.message;
triggerEvent('error', errorMessage);
reject(error);
});
}
};
const publishToSession = publisher => session.publish(publisher, onPublish(publisher));
const handleError = (error) => {
logging.log(logging.logAction.startCall, logging.logVariation.fail);
const errorMessage = error.code === 1010 ? 'Check your network connection' : error.message;
triggerEvent('error', errorMessage);
reject(error);
};
createPublisher()
.then(publishToSession)
.catch(handleError);
});

@@ -191,4 +201,8 @@

const startCall = () =>
new Promise((resolve, reject) => {
new Promise((resolve, reject) => { // eslint-disable-line consistent-return
logging.log(logging.logAction.startCall, logging.logVariation.attempt);
/**
* Determine if we're able to join the session based on an existing connection limit
*/
if (!ableToJoin()) {

@@ -201,18 +215,38 @@ const errorMessage = 'Session has reached its connection limit';

/**
* Subscribe to any streams that existed before we start the call from our side.
*/
const subscribeToInitialStreams = (publisher) => {
// Get an array of initial subscription promises
const initialSubscriptions = () => {
if (autoSubscribe) {
const streams = state.getStreams();
return Object.keys(streams).map(id => subscribe(streams[id]));
}
return [Promise.resolve()];
};
// Handle success
const onSubscribeToAll = () => {
const pubSubData = Object.assign({}, state.getPubSub(), { publisher });
triggerEvent('startCall', pubSubData);
active = true;
resolve(pubSubData);
};
// Handle error
const onError = (reason) => {
logging.message(`Failed to subscribe to all existing streams: ${reason}`);
// We do not reject here in case we still successfully publish to the session
resolve(Object.assign({}, state.getPubSub(), { publisher }));
};
Promise.all(initialSubscriptions())
.then(onSubscribeToAll)
.catch(onError);
};
publish()
.then((publisher) => {
const initialSubscriptions = () => {
if (autoSubscribe) {
const streams = state.getStreams();
return Object.keys(streams).map(id => subscribe(streams[id]));
}
return [Promise.resolve()];
};
Promise.all(initialSubscriptions()).then(() => {
const pubSubData = Object.assign({}, state.getPubSub(), { publisher });
triggerEvent('startCall', pubSubData);
active = true;
resolve(pubSubData);
}).catch(reason => logging.message(`Failed to subscribe to all existing streams: ${reason}`));
});
.then(subscribeToInitialStreams)
.catch(reject);
});

@@ -219,0 +253,0 @@

@@ -88,8 +88,20 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

return new Promise(function (resolve, reject) {
createPublisher().then(function (publisher) {
state.addPublisher('camera', publisher);
session.publish(publisher);
logging.log(logging.logAction.startCall, logging.logVariation.success);
resolve(publisher);
}).catch(function (error) {
var onPublish = function onPublish(publisher) {
return function (error) {
if (error) {
reject(error);
logging.log(logging.logAction.startCall, logging.logVariation.fail);
} else {
logging.log(logging.logAction.startCall, logging.logVariation.success);
state.addPublisher('camera', publisher);
resolve(publisher);
}
};
};
var publishToSession = function publishToSession(publisher) {
return session.publish(publisher, onPublish(publisher));
};
var handleError = function handleError(error) {
logging.log(logging.logAction.startCall, logging.logVariation.fail);

@@ -99,3 +111,5 @@ var errorMessage = error.code === 1010 ? 'Check your network connection' : error.message;

reject(error);
});
};
createPublisher().then(publishToSession).catch(handleError);
});

@@ -214,3 +228,8 @@ };

return new Promise(function (resolve, reject) {
// eslint-disable-line consistent-return
logging.log(logging.logAction.startCall, logging.logVariation.attempt);
/**
* Determine if we're able to join the session based on an existing connection limit
*/
if (!ableToJoin()) {

@@ -223,3 +242,7 @@ var errorMessage = 'Session has reached its connection limit';

publish().then(function (publisher) {
/**
* Subscribe to any streams that existed before we start the call from our side.
*/
var subscribeToInitialStreams = function subscribeToInitialStreams(publisher) {
// Get an array of initial subscription promises
var initialSubscriptions = function initialSubscriptions() {

@@ -240,3 +263,5 @@ if (autoSubscribe) {

};
Promise.all(initialSubscriptions()).then(function () {
// Handle success
var onSubscribeToAll = function onSubscribeToAll() {
var pubSubData = Object.assign({}, state.getPubSub(), { publisher: publisher });

@@ -246,6 +271,15 @@ triggerEvent('startCall', pubSubData);

resolve(pubSubData);
}).catch(function (reason) {
return logging.message('Failed to subscribe to all existing streams: ' + reason);
});
});
};
// Handle error
var onError = function onError(reason) {
logging.message('Failed to subscribe to all existing streams: ' + reason);
// We do not reject here in case we still successfully publish to the session
resolve(Object.assign({}, state.getPubSub(), { publisher: publisher }));
};
Promise.all(initialSubscriptions()).then(onSubscribeToAll).catch(onError);
};
publish().then(subscribeToInitialStreams).catch(reject);
});

@@ -252,0 +286,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc