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

treble-hook

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

treble-hook - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

5

lib/index.d.ts

@@ -0,1 +1,6 @@

export declare enum TupleIndex {
State = 0,
Publish = 1,
Unsubscribe = 2
}
export declare function usePubSub<T>(topic: string, defaultState: T): SubscriptionTuple<T>;

@@ -2,0 +7,0 @@ declare type Publish<T> = (newState: T) => void;

9

lib/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("react");
const HOOK_PUBLISH_INDEX = 1;
var TupleIndex;
(function (TupleIndex) {
TupleIndex[TupleIndex["State"] = 0] = "State";
TupleIndex[TupleIndex["Publish"] = 1] = "Publish";
TupleIndex[TupleIndex["Unsubscribe"] = 2] = "Unsubscribe";
})(TupleIndex = exports.TupleIndex || (exports.TupleIndex = {}));
const getUUID = (a, b) => {

@@ -23,3 +28,3 @@ for (b = a = ''; a++ < 36; b += 4 << ~a * 6.5 ? (a ^ 15 ? 8 ^ Math.random() * (a ^ 20 ? 16 : 4) : 4).toString(16) : '-')

if (topicRecord) {
Object.values(topicRecord.subscriptionMap).forEach(publicHook => publicHook[HOOK_PUBLISH_INDEX](newState));
Object.values(topicRecord.subscriptionMap).forEach(publicHook => publicHook[TupleIndex.Publish](newState));
topicRecord.currentState = newState;

@@ -26,0 +31,0 @@ topicRecord.hasBeenPublished = true;

{
"name": "treble-hook",
"version": "0.0.14",
"version": "0.0.15",
"description": "Get hooked on simple subscribe-and-publish in ReactJS.",

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

Sorry, the diff of this file is not supported yet

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