You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

vpaid-flash-client

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vpaid-flash-client - npm Package Compare versions

Comparing version

to
0.1.7

37

bin/VPAIDFLASHClient.js

@@ -592,4 +592,2 @@ (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){

value: function callFlashMethod(methodName) {
var _this = this;
var args = arguments[1] === undefined ? [] : arguments[1];

@@ -611,8 +609,3 @@ var callback = arguments[2] === undefined ? undefined : arguments[2];

if (callback) {
setTimeout(function () {
if (_this._callbacks.get(callbackID)) {
_this._callbacks.remove(callbackID);
callback(e);
}
}, 0);
$asyncCallback.call(this, callbackID, e);
} else {

@@ -633,3 +626,3 @@

value: function removeCallbackByMethodName(suffix) {
var _this2 = this;
var _this = this;

@@ -639,3 +632,3 @@ this._callbacks.filterKeys(function (key) {

}).forEach(function (key) {
_this2._callbacks.remove(key);
_this._callbacks.remove(key);
});

@@ -651,3 +644,3 @@ }

value: function _trigger(eventName, event) {
var _this3 = this;
var _this2 = this;

@@ -660,3 +653,3 @@ this._handlers.get(eventName).forEach(function (callback) {

setTimeout(function () {
if (_this3._handlers.get(eventName)) {
if (_this2._handlers.get(eventName).length > 0) {
callback(event);

@@ -671,3 +664,2 @@ }

value: function _callCallback(methodName, callbackID, err, result) {
var _this4 = this;

@@ -685,8 +677,3 @@ var callback = this._callbacks.get(callbackID);

setTimeout(function () {
if (_this4._callbacks.get(callbackID)) {
_this4._callbacks.remove(callbackID);
callback(err, result);
}
}, 0);
$asyncCallback.call(this, callbackID, err, result);
}

@@ -769,2 +756,14 @@ }, {

function $asyncCallback(callbackID, err, result) {
var _this3 = this;
setTimeout(function () {
var callback = _this3._callbacks.get(callbackID);
if (callback) {
_this3._callbacks.remove(callbackID);
callback(err, result);
}
}, 0);
}
Object.defineProperty(JSFlashBridge, 'VPAID_FLASH_HANDLER', {

@@ -771,0 +770,0 @@ writable: false,

{
"name": "VPAIDFLASHClient",
"version": "0.1.6",
"version": "0.1.7",
"authors": [

@@ -5,0 +5,0 @@ "Luis Silva <luis.dasilva@mailonline.co.uk>"

@@ -60,8 +60,3 @@ 'use strict';

if (callback) {
setTimeout(() => {
if (this._callbacks.get(callbackID)) {
this._callbacks.remove(callbackID);
callback(e);
}
}, 0);
$asyncCallback.call(this, callbackID, e);
} else {

@@ -98,3 +93,3 @@

setTimeout(() => {
if (this._handlers.get(eventName)) {
if (this._handlers.get(eventName).length > 0) {
callback(event);

@@ -120,8 +115,3 @@ }

setTimeout(() => {
if (this._callbacks.get(callbackID)) {
this._callbacks.remove(callbackID);
callback(err, result);
}
}, 0);
$asyncCallback.call(this, callbackID, err, result);

@@ -179,2 +169,12 @@ }

function $asyncCallback(callbackID, err, result) {
setTimeout(() => {
let callback = this._callbacks.get(callbackID);
if (callback) {
this._callbacks.remove(callbackID);
callback(err, result);
}
}, 0);
}
Object.defineProperty(JSFlashBridge, 'VPAID_FLASH_HANDLER', {

@@ -181,0 +181,0 @@ writable: false,

{
"name": "vpaid-flash-client",
"version": "0.1.6",
"version": "0.1.7",
"author": "Luis da Silva <luis.dasilva@mailonline.co.uk>",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/MailOnline/VPAIDFLASHClient",

@@ -8,3 +8,3 @@ let JSFlashBridge = require('../../js/jsFlashBridge.js').JSFlashBridge;

describe('jsFlashBridge.js api', function() {
let el;
let el, clock;
const EL_ID = 'hello';

@@ -17,4 +17,10 @@

addFlashMethodsToEl(el, EL_ID);
clock = sinon.useFakeTimers();
});
afterEach(function () {
clock.restore();
});
it('must create in global a function in global scope', function () {

@@ -29,9 +35,2 @@ assert.isFunction(window[JSFlashBridge.VPAID_FLASH_HANDLER]);

it('must destroy instance from registry', function () {
var instance = new JSFlashBridge(el, '', EL_ID, 10, 10, noop);
assert.equal(instance, registry.getInstanceByID(EL_ID));
instance.destroy();
assert.isUndefined(registry.getInstanceByID(EL_ID));
});
[

@@ -111,2 +110,4 @@ { key: 'getSize', value: {width: 15, height: 10} },

instance.callFlashMethod(METHOD_NAME, []);
clock.tick(100);
});

@@ -133,2 +134,4 @@

assert.equal(instance._callbacks.size(), 1);
clock.tick(100);
});

@@ -147,2 +150,4 @@

instance.callFlashMethod(METHOD_NAME, [], noop);
clock.tick(100);
});

@@ -181,2 +186,4 @@

window[JSFlashBridge.VPAID_FLASH_HANDLER](EL_ID, 'event', EVENT_NAME, '', null, true);
clock.tick(100);
});

@@ -207,5 +214,43 @@

window[JSFlashBridge.VPAID_FLASH_HANDLER](EL_ID, 'event', EVENT_NAME, '', null, true);
clock.tick(100);
});
describe('destroy', function () {
it('must destroy instance from registry', function () {
var instance = new JSFlashBridge(el, '', EL_ID, 10, 10, noop);
assert.equal(instance, registry.getInstanceByID(EL_ID));
instance.destroy();
assert.isUndefined(registry.getInstanceByID(EL_ID));
});
it('must avoid calling a callback if is destroyed', function() {
const METHOD_NAME = '123';
var instance = new JSFlashBridge(el, 'url', EL_ID, 15, 10, noop);
var callback = sinon.spy();
instance._callbacks.add(METHOD_NAME, callback);
window[JSFlashBridge.VPAID_FLASH_HANDLER](EL_ID, 'method', METHOD_NAME, '', null, true);
instance.destroy();
clock.tick(100);
assert(!callback.called);
});
it('must avoid triggering the eventlisteners if is destroyed', function() {
const EVENT_NAME = 'someEvent';
var instance = new JSFlashBridge(el, 'url', EL_ID, 15, 10, noop);
var callback = sinon.spy();
instance.on(EVENT_NAME, callback);
window[JSFlashBridge.VPAID_FLASH_HANDLER](EL_ID, 'event', EVENT_NAME, '', null, true);
instance.destroy();
clock.tick(100);
assert(!callback.called);
});
});
});

@@ -50,3 +50,2 @@ let VPAIDFLASHClient = require('../../js/VPAIDFLASHClient.js');

describe('swfobject', function() {

@@ -53,0 +52,0 @@ describe('when no swfobject', function () {

Sorry, the diff of this file is not supported yet