npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sharedb-monaco-cursors

v0.0.27

Published

Real-time cursor support for sharedb-monaco

Readme

sharedb-monaco-cursors

Collaborative Cursor and Selection support for sharedb-monaco.

(If you're using your own ShareDB Monaco implementation, sharedb-monaco-cursors will work even without sharedb-monaco installed)

Developed for the CodeCollab project.

Tested and works well with monaco-react.

Install

Using NPM:

$ npm install sharedb-monaco-cursors

Usage

sharedb-monaco-cursors relies on the ShareDB Presence API to work. Before using this library, ensure that this API is enabled on the server as it is disabled by default.

To enable the Presence API on the server:

let shareConfig = {
    db,
    presence: true  // This line enables Presence
}

const share = new ShareDB(shareConfig);

Sample usage of this library in action

import ShareDBMonaco from "sharedb-monaco";
import ShareDBMonacoCursors from "sharedb-monaco-cursors";
import monaco from "monaco-editor";

// Get a monaco editor (ICodeEditor) instance
let editor = monaco.editor.create(document.getElementById("editor"), {
    value: "print('Hello World!')",
    language: "python"
});

// Initialise sharedb-monaco
let binding = new ShareDBMonaco(options);
let model = binding.add(editor, attachOptions);

// Initialise sharedb-monaco-cursors
let cursors = new ShareDBMonacoCursors(cursorOptions);

new ShareDBMonacoCursors(options)

  • options <Object>
    • id <string> ID of the ShareDB document
    • namespace <string> The namespace of document within ShareDB, to be equal to that on the server
    • name <string> Name of this user, to be displayed to other connected users.
    • editors <monaco.editor.ICodeEditor[]> Array of ICodeEditors to bind cursors to.
    • viewOnly <boolean> Should local cursor and selection events be listened and broadcasted. Default: false
    • colors <string[]> Array of color codes to use for cursors. Defaults to ['BurlyWood', 'lightseagreen', 'Violet', 'Red', 'forestgreen', 'DarkViolet', 'OrangeRed', 'navy', 'darkviolet', 'maroon']
    • uid <string> Unique Identifier for each user's cursors. Important if you want to manage cursors across multiple ShareDBMonacoCursors instances and documents at the same time.

cursors.setViewOnly(viewOnly)

Toggles the view-only state of the cursors.

  • viewOnly <boolean> Should this document ignore local cursor and selection events.

cursors.addEditor(editor)

Add an editor to bind cursor and selection event listeners to

  • editor <monaco.editor.ICodeEditor> The editor to bind listeners to

cursors.removeEditor(id)

Remove an editor from listening and receiving cursor and selection events

  • id <string> Id of the ICodeEditor instance from ICodeEditor.getId()

cursors.dispose()

Closes all event listeners, removes all cursors and clean up. Will also unsubscribe and destroy the presence.


License

MIT