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

pubsub-js

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pubsub-js - npm Package Compare versions

Comparing version 1.6.1 to 1.7.0

test/test-symbol.js

2

package.json
{
"name": "pubsub-js",
"version": "1.6.1",
"version": "1.7.0",
"description": "Dependency free publish/subscribe library",

@@ -5,0 +5,0 @@ "main": "./src/pubsub.js",

@@ -185,2 +185,17 @@ <div align="center">

### Example of use of "symbol constants" with ES6/7 syntax
```javascript
// event-types.js
export const MY_TOPIC = Symbol('MY_TOPIC')
// somefile.js
import { MY_TOPIC } from './event-types.js'
PubSub.subscribe(MY_TOPIC, function (msg, data) {
console.log(data)
});
PubSub.publish(MY_TOPIC, 'world');
```
### Immediate Exceptions for stack traces in developer tools

@@ -187,0 +202,0 @@

@@ -120,2 +120,4 @@ /**

function publish( message, data, sync, immediateExceptions ){
message = (typeof message === 'symbol') ? message.toString() : message;
var deliver = createDeliveryFunction( message, data, immediateExceptions ),

@@ -173,2 +175,4 @@ hasSubscribers = messageHasSubscribers( message );

message = (typeof message === 'symbol') ? message.toString() : message;
// message is not registered yet

@@ -183,3 +187,3 @@ if ( !messages.hasOwnProperty( message ) ){

messages[message][token] = func;
// return token for unsubscribing

@@ -186,0 +190,0 @@ return token;

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