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

react-use-action-cable-ts

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-action-cable-ts - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

10

dist/index.d.ts
import { ChannelNameWithParams, Consumer, Subscription } from "@rails/actioncable";
type Action = Parameters<Subscription<Consumer>["perform"]>[0];
type Payload = Parameters<Subscription<Consumer>["perform"]>[1];
type Action = Parameters<Subscription["perform"]>[0];
type Payload = Parameters<Subscription["perform"]>[1];
export declare function useActionCable(url: string, { verbose }?: {

@@ -10,5 +10,5 @@ verbose: boolean;

export type ChannelOptions = {
verbose: boolean;
incomingTransformer?: <T>(incomingData: T) => T;
outgoingTransformer?: <T>(outgoingData: T) => T;
verbose?: boolean;
incomingTransformer?: <T extends Payload | ChannelNameWithParams>(incomingData: T) => T extends ChannelNameWithParams ? ChannelNameWithParams : Payload;
outgoingTransformer?: <T extends Payload | ChannelNameWithParams>(outgoingData: T) => T extends ChannelNameWithParams ? ChannelNameWithParams : Payload;
};

@@ -15,0 +15,0 @@ export declare function useChannel<T>(actionCable: Consumer, { verbose, incomingTransformer, outgoingTransformer }?: ChannelOptions): {

@@ -32,7 +32,3 @@ "use strict";

exports.useActionCable = useActionCable;
function useChannel(actionCable, { verbose, incomingTransformer, outgoingTransformer } = {
verbose: false,
incomingTransformer: null,
outgoingTransformer: null
}) {
function useChannel(actionCable, { verbose, incomingTransformer, outgoingTransformer } = {}) {
const [queue, setQueue] = (0, react_1.useState)([]);

@@ -56,3 +52,3 @@ const [connected, setConnected] = (0, react_1.useState)(false);

log({
verbose: verbose,
verbose,
type: "info",

@@ -155,5 +151,5 @@ message: `Received ${JSON.stringify(x)}`

if (subscribed && !connected)
throw "useActionCable: not connected";
throw Error("useActionCable: not connected");
if (!subscribed)
throw "useActionCable: not subscribed";
throw Error("useActionCable: not subscribed");
try {

@@ -168,3 +164,3 @@ log({

catch {
throw "useActionCable: Unknown error";
throw Error("useActionCable: Unknown error");
}

@@ -171,0 +167,0 @@ };

{
"name": "react-use-action-cable-ts",
"version": "2.0.0",
"version": "2.0.1",
"description": "Hooks to easily use Rails Action Cable in your React application",

@@ -12,3 +12,3 @@ "main": "./dist/index.js",

"test": "npm run lint && jest",
"lint": "eslint . --max-warnings 0"
"lint": "eslint ./index.ts --max-warnings 0"
},

@@ -15,0 +15,0 @@ "author": "Anton Frattaroli",

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