New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@foundit/broadcasterjs

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@foundit/broadcasterjs - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

34

dist/esm/index.js

@@ -21,3 +21,3 @@ var __assign = (this && this.__assign) || function () {

useLatestSubscriberScope: true,
suppresDebug: false,
suppressDebug: false,
};

@@ -34,3 +34,3 @@ var eventBus = function () {

// Remove previous listener and set new to update scope.
off([type, listener, { suppresDebug: true }]);
off([type, listener, { suppressDebug: true }]);
debugmode({

@@ -41,8 +41,7 @@ string: "Subscriber ".concat(type, " existed. Will update scope."),

}
if (options.debug)
debugmode({
string: "".concat(exists ? 'Updating listener scope' : 'Setting new listener', " for \"").concat(type, "\""),
obj: listener,
force: true,
});
debugmode({
string: "".concat(exists ? "Updating listener scope for ".concat(id) : 'Setting new listener', " for \"").concat(type, " (id:").concat(id, "})\""),
obj: listener,
force: options.debug,
});
var eventTarget = createOrGetCustomEventNode(hubId);

@@ -71,9 +70,8 @@ eventTarget.addEventListener('broadcast-' + type, listener);

var options = setOptions(settings);
if (options.debug)
debugmode({
string: "Removing listener \"".concat(type, "\""),
obj: listener,
force: true,
settings: settings,
});
debugmode({
string: "Removing listener \"".concat(type, "\""),
obj: listener,
force: options.debug,
settings: settings,
});
handleCache().remove(type, listener);

@@ -116,3 +114,3 @@ var eventTarget = createOrGetCustomEventNode(hubId);

debugmode({
string: 'Found a previous instans of subscriber.',
string: "Found a previous instans of ".concat(type, "."),
force: settings.debug,

@@ -173,3 +171,3 @@ });

var string = _a.string, obj = _a.obj, force = _a.force, settings = _a.settings;
if ((!globalDebug && !force) || (settings === null || settings === void 0 ? void 0 : settings.suppresDebug))
if ((!globalDebug && !force) || (settings === null || settings === void 0 ? void 0 : settings.suppressDebug))
return;

@@ -221,4 +219,4 @@ var style = 'color:#bada55;background:#666;padding:0.3rem 0.5rem;border-radius:3px';

useLatestSubscriberScope: true,
suppresDebug: false,
suppressDebug: false,
}
*/

@@ -18,5 +18,5 @@ export declare type listenerProp<T extends unknown> = [

useLatestSubscriberScope?: boolean;
suppresDebug?: boolean;
suppressDebug?: boolean;
}
declare const broadcast: ReturnType;
export { broadcast };

@@ -24,3 +24,3 @@ "use strict";

useLatestSubscriberScope: true,
suppresDebug: false,
suppressDebug: false,
};

@@ -37,3 +37,3 @@ var eventBus = function () {

// Remove previous listener and set new to update scope.
off([type, listener, { suppresDebug: true }]);
off([type, listener, { suppressDebug: true }]);
debugmode({

@@ -44,8 +44,7 @@ string: "Subscriber ".concat(type, " existed. Will update scope."),

}
if (options.debug)
debugmode({
string: "".concat(exists ? 'Updating listener scope' : 'Setting new listener', " for \"").concat(type, "\""),
obj: listener,
force: true,
});
debugmode({
string: "".concat(exists ? "Updating listener scope for ".concat(id) : 'Setting new listener', " for \"").concat(type, " (id:").concat(id, "})\""),
obj: listener,
force: options.debug,
});
var eventTarget = createOrGetCustomEventNode(hubId);

@@ -74,9 +73,8 @@ eventTarget.addEventListener('broadcast-' + type, listener);

var options = setOptions(settings);
if (options.debug)
debugmode({
string: "Removing listener \"".concat(type, "\""),
obj: listener,
force: true,
settings: settings,
});
debugmode({
string: "Removing listener \"".concat(type, "\""),
obj: listener,
force: options.debug,
settings: settings,
});
handleCache().remove(type, listener);

@@ -119,3 +117,3 @@ var eventTarget = createOrGetCustomEventNode(hubId);

debugmode({
string: 'Found a previous instans of subscriber.',
string: "Found a previous instans of ".concat(type, "."),
force: settings.debug,

@@ -176,3 +174,3 @@ });

var string = _a.string, obj = _a.obj, force = _a.force, settings = _a.settings;
if ((!globalDebug && !force) || (settings === null || settings === void 0 ? void 0 : settings.suppresDebug))
if ((!globalDebug && !force) || (settings === null || settings === void 0 ? void 0 : settings.suppressDebug))
return;

@@ -224,4 +222,4 @@ var style = 'color:#bada55;background:#666;padding:0.3rem 0.5rem;border-radius:3px';

useLatestSubscriberScope: true,
suppresDebug: false,
suppressDebug: false,
}
*/
{
"name": "@foundit/broadcasterjs",
"version": "1.0.4",
"version": "1.0.5",
"description": "A simple yet powerful pub/sub javascript event bus",

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

@@ -12,4 +12,5 @@ # broadcasterjs

[Demo app available](http://broadcasterjs.hervy.se)
[Demo app source code](https://github.com/nicatspark/broadcasterjs-demo-app)
- Here you can [report issues or contribute](https://github.com/nicatspark/broadcasterjs)
- [Demo app available](http://broadcasterjs.hervy.se)
- [Source code of the demo app](https://github.com/nicatspark/broadcasterjs-demo-app)

@@ -26,5 +27,5 @@ ---

useEffect(() => {
broadcast.on(['MYBROADCAST-ID', flagReceivedFunction])
return () => broadcast.off(['MYBROADCAST-ID', flagReceivedFunction])
}, [flagReceivedFunction])
broadcast.on(['MYBROADCAST-ID', myFlagEmittedCallbackFunction])
return () => broadcast.off(['MYBROADCAST-ID', myFlagEmittedCallbackFunction])
}, [myFlagEmittedCallbackFunction])
```

@@ -65,3 +66,3 @@

##### PUBLISH IN REACT & VANILLLA JS
##### PUBLISH IN REACT & VANILLLA JS (place anywhere)

@@ -88,8 +89,10 @@ ```typescript

{
debug: boolean
debugGlobal: boolean
allowDoublettesSubscribers: boolean
debug: boolean (false)
debugGlobal: boolean (false)
allowDoublettesSubscribers: boolean (false)
useLatestSubscriberScope?: boolean (false) // <- internal use
suppresDebug?: boolean (false) // <- internal use
}
```
Broadcasterjs does prevent doublettes with the same subscriber combination (flag + callback function). If you for some reason would want the same combination on another place in the code either just add a minor change, a comment etc or send in the settings object with `allowDoublettesSubscribers` set to true.
Broadcasterjs does prevent doublettes with the same subscriber combination (flag + callback function). If you for some reason would want the same combination on another place in the code either just add a minor change, a comment in the callback function etc or send in the settings object with `allowDoublettesSubscribers` set to true.
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