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

@storybook/channels

Package Overview
Dependencies
Maintainers
10
Versions
1966
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/channels - npm Package Compare versions

Comparing version 4.0.0-alpha.16 to 4.0.0-alpha.17

dist/index.test.js

57

dist/index.js
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _toConsumableArray2 = require("babel-runtime/helpers/toConsumableArray");
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _keys = require("babel-runtime/core-js/object/keys");
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _keys2 = _interopRequireDefault(_keys);
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require("babel-runtime/helpers/createClass");
var _createClass3 = _interopRequireDefault(_createClass2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint no-underscore-dangle: 0 */
var Channel = function () {
var Channel =
/*#__PURE__*/
function () {
function Channel(_ref) {

@@ -32,13 +24,14 @@ var _this = this;

var transport = _ref.transport;
(0, _classCallCheck3.default)(this, Channel);
(0, _classCallCheck2.default)(this, Channel);
this._sender = this._randomId();
this._transport = transport;
this._transport.setHandler(function (event) {
return _this._handleEvent(event);
});
this._listeners = {};
}
(0, _createClass3.default)(Channel, [{
(0, _createClass2.default)(Channel, [{
key: "addListener",

@@ -58,8 +51,14 @@ value: function addListener(type, listener) {

value: function emit(type) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var event = { type: type, args: args, from: this._sender };
var event = {
type: type,
args: args,
from: this._sender
};
this._transport.send(event);
this._handleEvent(event, true);

@@ -70,3 +69,3 @@ }

value: function eventNames() {
return (0, _keys2.default)(this._listeners);
return Object.keys(this._listeners);
}

@@ -88,2 +87,3 @@ }, {

this._listeners[type] = this._listeners[type] || [];
this._listeners[type].push(listener);

@@ -95,2 +95,3 @@ }

var onceListener = this._onceListener(type, listener);
this.on(type, onceListener);

@@ -102,2 +103,3 @@ }

this._listeners[type] = this._listeners[type] || [];
this._listeners[type].unshift(listener);

@@ -109,2 +111,3 @@ }

var onceListener = this._onceListener(type, listener);
this.prependListener(type, onceListener);

@@ -125,2 +128,3 @@ }

var listeners = this._listeners[type];
if (listeners) {

@@ -142,5 +146,6 @@ this._listeners[type] = listeners.filter(function (l) {

var listeners = this._listeners[event.type];
if (listeners && (isPeer || event.from !== this._sender)) {
listeners.forEach(function (fn) {
return !(isPeer && fn.ignorePeer) && fn.apply(undefined, (0, _toConsumableArray3.default)(event.args));
return !(isPeer && fn.ignorePeer) && fn.apply(void 0, (0, _toConsumableArray2.default)(event.args));
});

@@ -156,4 +161,6 @@ }

_this2.removeListener(type, onceListener);
return listener.apply(undefined, arguments);
return listener.apply(void 0, arguments);
};
return onceListener;

@@ -160,0 +167,0 @@ }

{
"name": "@storybook/channels",
"version": "4.0.0-alpha.16",
"version": "4.0.0-alpha.17",
"description": "",

@@ -5,0 +5,0 @@ "license": "MIT",

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