Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uvm

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uvm - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

3

CHANGELOG.md
# Postman UVM Changelog
#### 1.6.0 (May 30, 2017)
* add support for removal of bridge events (internal) using `bridge.off`
#### 1.5.1 (May 29, 2017)

@@ -4,0 +7,0 @@ * uvm now dispatches `disconnect` event right before disconnecting

@@ -39,4 +39,19 @@ /**

on: function (name, listener) {
if (typeof listener !== 'function') { return; }
!this._events[name] && (this._events[name] = []);
this._events[name].push(listener);
},
off: function (name, listener) {
var e = this._events[name],
i = e && this._events[name].length;
if (!e) { return; }
if (typeof listener === 'function' && (i >= 1)) {
while (i >= 0) {
(e[i] === listener) && e.splice(i, 1);
i -= 1;
}
}
if (!e.length) { delete this._events[name]; }
}

@@ -43,0 +58,0 @@ };

2

package.json
{
"name": "uvm",
"version": "1.5.1",
"version": "1.6.0",
"description": "Universal Virtual Machine for Node and Browser",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -150,2 +150,48 @@ var vm = require('vm');

it('must be able to remove a particular registered event', function (done) {
var context = vm.createContext({
expect: expect,
__uvm_emit: function () {
throw new Error('Nothing should be emitted');
},
done: function () {
expect(arguments.length).be(0);
done();
}
});
vm.runInContext(bridgeClient(), context);
vm.runInContext(`
var one = false,
two = false,
updateTwo;
bridge.on('loopback', function () {
expect(one).be(false);
expect(two).be(false);
one = true;
});
updateTwo = function () {
expect(one).be(true);
expect(two).be(false);
two = true;
};
bridge.on('loopback', updateTwo);
bridge.on('loopback', function () {
expect(one).be(true);
expect(two).be(false);
done();
});
bridge.off('loopback', updateTwo); // remove one event
bridge.emit('loopback');
`, context);
});
it('must not leave behind any additional globals except `bridge` related', function (done) {

@@ -152,0 +198,0 @@ var context = vm.createContext({

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