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

realtimejul22

v1.2.1

Published

Real-time cursor tracking and collaboration for web applications

Downloads

9

Readme

RealtimeJul22

A lightweight library for real-time cursor tracking and collaboration in web applications.

Installation

npm install realtimejul22

Quick Start

import { RealtimeCursor } from 'realtimejul22';

const cursor = new RealtimeCursor({
  projectId: 'your-project-id',
  user: {
    id: 'user-123',
    name: 'John Doe',
    color: '#3b82f6'
  }
});

cursor.connect();

CDN Usage

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js"></script>
<script>
  const cursor = new realtimejul22.RealtimeCursor({
    projectId: 'your-project-id',
    user: {
      id: 'user-123',
      name: 'John Doe',
      color: '#3b82f6'
    }
  });
  
  cursor.connect();
</script>

Features

  • 🖱️ Real-time cursor tracking
  • 👥 Collaborator presence
  • 📝 Content synchronization
  • ⌨️ Typing indicators
  • 🔄 Automatic reconnection
  • 🎨 Customizable cursors and colors

API Reference

RealtimeCursor

const cursor = new RealtimeCursor(options);

Options

  • apiUrl (string): URL of the RealtimeCursor API server (defaults to hosted service)
  • projectId (string): Unique identifier for the project
  • user (object): User information
    • id (string): Unique identifier for the user
    • name (string): Display name for the user
    • color (string, optional): Color for the user's cursor (hex code)
  • debug (boolean, optional): Enable debug logging

Methods

  • connect(): Connect to the real-time service
  • disconnect(): Disconnect from the real-time service
  • updateCursor(position): Update cursor position
  • updateContent(content): Update content
  • updateTypingStatus(isTyping): Update typing status
  • on(event, callback): Add event listener
  • off(event, callback): Remove event listener
  • getCollaborators(): Get all collaborators
  • getCursors(): Get all cursors
  • getTypingStatus(): Get typing status
  • isConnected(): Get connection status

Events

  • connect: Emitted when connected to the service
  • disconnect: Emitted when disconnected from the service
  • cursors-changed: Emitted when cursors are updated
  • collaborators-changed: Emitted when collaborators list changes
  • typing-status-changed: Emitted when typing status changes
  • content-updated: Emitted when content is updated by another user
  • user-joined: Emitted when a user joins
  • user-left: Emitted when a user leaves
  • error: Emitted when an error occurs

React Hook

import { useRealtimeCursor } from 'realtimejul22';

function Editor() {
  const { 
    cursors, 
    collaborators,
    connected,
    typingStatus,
    connect,
    disconnect,
    updateCursor, 
    updateContent,
    updateTypingStatus
  } = useRealtimeCursor({
    projectId: 'your-project-id',
    user: {
      id: 'user-123',
      name: 'John Doe',
      color: '#3b82f6'
    }
  });
  
  // Use the hook...
}

Example

// Initialize the cursor client
const cursor = new RealtimeCursor({
  projectId: 'my-project',
  user: {
    id: 'user-123',
    name: 'John Doe',
    color: '#3b82f6'
  }
});

// Connect to the real-time service
cursor.connect();

// Set up event handlers
cursor.on('connect', () => {
  console.log('Connected to real-time service');
});

cursor.on('collaborators-changed', (collaborators) => {
  console.log('Active collaborators:', collaborators);
});

cursor.on('cursors-changed', (cursors) => {
  console.log('Cursor positions:', cursors);
});

// Update cursor position on mouse move
document.addEventListener('mousemove', (e) => {
  const editorElement = document.getElementById('editor');
  const rect = editorElement.getBoundingClientRect();
  
  cursor.updateCursor({
    x: e.clientX,
    y: e.clientY,
    relativeX: e.clientX - rect.left,
    relativeY: e.clientY - rect.top
  });
});

// Update content
document.getElementById('editor').addEventListener('input', (e) => {
  cursor.updateContent(e.target.value);
  cursor.updateTypingStatus(true);
  
  // Reset typing status after 2 seconds
  setTimeout(() => {
    cursor.updateTypingStatus(false);
  }, 2000);
});

// Disconnect when done
window.addEventListener('beforeunload', () => {
  cursor.disconnect();
});

License

MIT