Socket
Socket
Sign inDemoInstall

@casperiv/use-socket.io

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@casperiv/use-socket.io - npm Package Compare versions

Comparing version 6.0.0 to 6.0.1

28

dist/index.js
import * as React from 'react';
import { io } from 'socket.io-client';
import { createWithEqualityFn } from 'zustand/traditional';
import { shallow } from 'zustand/shallow';
import { create } from 'zustand';
// src/core/provider.tsx
var useSocketStore = create((set, get) => ({
socket: null,
setSocket: (socket) => set({ socket }),
options: {},
setOptions: (options) => set({ options: { ...get().options, ...options } })
}));
var useSocketStore = createWithEqualityFn(
(set, get) => ({
socket: null,
setSocket: (socket) => set({ socket }),
options: {},
setOptions: (options) => set({ options: { ...get().options, ...options } })
}),
shallow
);
// src/hooks/useConnect.ts
var useConnect = () => {
const store = useSocketStore(
(state) => ({
socket: state.socket,
setSocket: state.setSocket
}),
shallow
);
const store = useSocketStore((state) => ({
socket: state.socket,
setSocket: state.setSocket
}));
const connect = (url, options) => {

@@ -24,0 +24,0 @@ if (store.socket?.connected) {

{
"name": "@casperiv/use-socket.io",
"version": "6.0.0",
"version": "6.0.1",
"description": "Use Socket.io-client with hooks",
"license": "MIT",
"homepage": "https://github.com/Dev-CasperTheGhost/use-socket.io#readme",
"homepage": "https://github.com/casperiv0/use-socket.io#readme",
"type": "module",

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

"author": {
"name": "Dev-CasperTheGhost",
"name": "casperiv0",
"url": "https://www.casperiv.dev"

@@ -45,7 +45,7 @@ },

"@casperiv/eslint-config-react": "^8.0.0",
"@types/react": "^18.2.20",
"eslint": "^8.47.0",
"prettier": "^3.0.2",
"@types/react": "^18.2.21",
"eslint": "^8.49.0",
"prettier": "^3.0.3",
"socket.io": ">=4.7",
"typescript": "^5.1.6"
"typescript": "^5.2.2"
},

@@ -59,7 +59,7 @@ "peerDependencies": {

"type": "git",
"url": "https://github.com/Dev-CasperTheGhost/use-socket.io"
"url": "https://github.com/casperiv0/use-socket.io"
},
"bugs": {
"url": "https://github.com/Dev-CasperTheGhost/use-socket.io/issues"
"url": "https://github.com/casperiv0/use-socket.io/issues"
}
}

@@ -42,2 +42,2 @@ # use-socket.io

[You can view documentation here](https://github.com/Dev-CasperTheGhost/use-socket.io/blob/main/docs/README.md)
[You can view documentation here](https://github.com/casperiv0/use-socket.io/blob/main/docs/README.md)

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