Comparing version 1.6.1 to 1.7.0
{ | ||
"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; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
49246
16
971
242
0