Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@liveblocks/node
Advanced tools
A server-side utility that lets you set up a Liveblocks authentication endpoint.
@liveblocks/node
A server-side utility that lets you set up a Liveblocks authentication endpoint.
npm install @liveblocks/node
Read the documentation for guides and API references.
Explore our collaborative examples to help you get started.
All examples are open-source and live in this repository, within
/examples
.
See the latest changes or learn more about upcoming releases.
Licensed under the Apache License 2.0, Copyright © 2021-present Liveblocks.
See LICENSE for more information.
v0.17.7
In @liveblocks/zustand:
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.
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)
FAQs
A server-side utility that lets you set up a Liveblocks authentication endpoint. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.
The npm package @liveblocks/node receives a total of 18,750 weekly downloads. As such, @liveblocks/node popularity was classified as popular.
We found that @liveblocks/node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.