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

@liveblocks/node

Package Overview
Dependencies
Maintainers
4
Versions
332
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@liveblocks/node - npm Package Versions

1
3133

0.18.0-beta0

Diff

nvie
published 0.17.11 •

Changelog

Source

v0.17.11

General:

  • Fix a packaging bug

In @liveblocks/react:

  • Deprecate an undocumented API
nvie
published 0.17.11-debug2 •

nvie
published 0.17.11-debug1 •

nvie
published 0.17.10 •

nvie
published 0.17.10-debug2 •

nvie
published 0.17.10-debug •

nvie
published 0.17.9 •

Changelog

Source

v0.17.9

  • Fix bug that could cause duplicate copies of @liveblocks/client to end up in final bundle, for certain bundler configurations.
  • Fix bug where in some conditions the initial presence for a new connection would not come through to all existing clients in the room
  • Various internal changes
nvie
published 0.17.8 •

Changelog

Source

v0.17.8

New history APIs ↩️ ↪️

  • In @liveblocks/client:

    • Add canUndo() and canRedo() utilities to room.history
    • Add "history" event type to room.subscribe() to subscribe to the current user's history changes
  • In @liveblocks/react:

    • Add useCanUndo() and useCanRedo() hooks
guillaumesalles
published 0.17.7 •

Changelog

Source

v0.17.7

  • In @liveblocks/zustand:

    • Simplify zustand middleware integration with Typescript. TPresence, TStorage, TUserMeta, and TRoomEvent are now optional.

Note that @liveblocks/zustand does not work with zustand > v4 because v3 and v4 have completely different type definitions. As soon as zustand v4 is out of the RC phase, we will consider updating our middleware to work with the latest version.

Example

Let's take a look at our To-do list example. Without our middleware, the store would look like this:

import create from "zustand";

type State = {
  draft: string;
  isTyping: boolean;
  todos: Todo[];
  setDraft: (draft: string) => void;
  addTodo: () => void;
  deleteTodo: (index: number) => void;
};

create<State>(/* ... */);

With our middleware, you simply need to move the State param at the middleware level:

import create from "zustand";
import { createClient } from "@liveblocks/client";
import { middleware } from "@liveblocks/zustand";

const client = createClient({ /*...*/ });

type State = {
  draft: string;
  isTyping: boolean;
  todos: Todo[];
  setDraft: (draft: string) => void;
  addTodo: () => void;
  deleteTodo: (index: number) => void;
};

create(
  middleware<State>(/* ... */, {
    client,
    presenceMapping: { isTyping: true },
    storageMapping: { todos: true }
  })
);

If you want to type others presence, you can use the TPresence generic argument on the middleware.


type Presence = {
  isTyping: true;
}

const useStore = create(
  middleware<State, Presence>(/* ... */, {
    client,
    presenceMapping: { isTyping: true },
    storageMapping: { todos: true }
  })
);

// In your component
useStore(state => state.liveblocks.others[0].presence?.isTyping)
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