Huge News!Announcing our $40M Series B led by Abstract Ventures.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.0 to 1.0.1

6

index.js

@@ -171,6 +171,6 @@ "use strict";

START SUBSCRIPTION VANILLA JS
broacaster.on(['BROADCAST-ID', ({ detail }) => {
broacast.on(['BROADCAST-ID', ({ detail }) => {
document.body.append(detail + ' ');
}]);
broacaster.once(['BROADCAST-ID', ({ detail }) => {
broacast.once(['BROADCAST-ID', ({ detail }) => {
document.body.append(detail + ' ');

@@ -180,3 +180,3 @@ }]);

END SUBSCRIPTION
broacaster.off(['BROADCAST-ID', ({ detail }) => {
broacast.off(['BROADCAST-ID', ({ detail }) => {
document.body.append(detail + ' ');

@@ -183,0 +183,0 @@ }]);

@@ -41,2 +41,7 @@ export type ListenerProps = <T extends unknown>([type, listener, settings]: [

const { exists, id } = handleCache().listenerExists(type, listener, options)
if (exists)
console.log({
string: `Subscriber existed ${type}`,
obj: broadcastItemsCache,
})
if (exists && !options.allowDoublettesSubscribers) return id

@@ -154,3 +159,10 @@ if (options.debug)

const remove = (type: string, listener: unknown) => {
const removeId = createBroadcastId(type, listener)
const removeId = type + createBroadcastId(type, listener)
debugmode({
string: `Remove listener: ${removeId}`,
obj:
broadcastItemsCache.indexOf(removeId) !== -1
? 'Existed'
: `Didn't exist`,
})
broadcastItemsCache = broadcastItemsCache.filter((id) => id !== removeId)

@@ -222,6 +234,6 @@ }

START SUBSCRIPTION VANILLA JS
broacaster.on(['BROADCAST-ID', ({ detail }) => {
broacast.on(['BROADCAST-ID', ({ detail }) => {
document.body.append(detail + ' ');
}]);
broacaster.once(['BROADCAST-ID', ({ detail }) => {
broacast.once(['BROADCAST-ID', ({ detail }) => {
document.body.append(detail + ' ');

@@ -231,3 +243,3 @@ }]);

END SUBSCRIPTION
broacaster.off(['BROADCAST-ID', ({ detail }) => {
broacast.off(['BROADCAST-ID', ({ detail }) => {
document.body.append(detail + ' ');

@@ -234,0 +246,0 @@ }]);

{
"name": "@foundit/broadcasterjs",
"version": "1.0.0",
"version": "1.0.1",
"description": "A simple yet powerful pub/sub javascript event bus",

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

@@ -11,3 +11,4 @@ # broadcasterjs

[Demo app available](https:broadcasterjs.hervy.se)
[Demo app available](http://broadcasterjs.hervy.se)
[Demo app source code](https://github.com/nicatspark/broadcasterjs-demo-app)

@@ -24,3 +25,3 @@ ---

useEffect(() => {
broadcast.on(['BROADCAST-ID', flagReceivedFunction])
broadcast.on(['MYBROADCAST-ID', flagReceivedFunction])
}, [flagReceivedFunction])

@@ -32,4 +33,4 @@ ```

```typescript
broacaster.on([
'BROADCAST-ID',
broacast.on([
'MYBROADCAST-ID',
({ detail }) => {

@@ -42,4 +43,4 @@ document.body.append(detail + ' ')

```typescript
broacaster.once([
'BROADCAST-ID',
broacast.once([
'MYBROADCAST-ID',
({ detail }) => {

@@ -54,4 +55,4 @@ document.body.append(detail + ' ')

```typescript
broacaster.off([
'BROADCAST-ID',
broacast.off([
'MYBROADCAST-ID',
({ detail }) => {

@@ -66,3 +67,3 @@ document.body.append(detail + ' ')

```typescript
broadcast.emit('BROADCAST-ID', 'Hello world')
broadcast.emit('MYBROADCAST-ID', 'Hello world')
```

@@ -69,0 +70,0 @@

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