1.0.16 • Published 3 years ago

realtime-notebook-client v1.0.16

Weekly downloads
70
License
MIT
Repository
-
Last release
3 years ago

Web UI can use this client to sync realtime Jupyter notebook changes.

Mechanism

This client connects to the hosted backend using Websocket protocol and automatically syncs realtime edits from multiple users in a Jupyter notebook.

Use this package

Install

yarn add realtime-notebook-client

Use

import { rtc } from 'realtime-notebook-client';

// Listen to remote changes
let notebookListener = rtc.hub(hubName).interval(500).onNotebookChange(
                fileName,
                initialFile,
                (file) => {
                    // This function will be called every 500 ms with the up to date notebook file
                    // You can use this file content to update the UI display
                });

// Report local changes to remote. This local change is the diff between current notebook file version and the previous synced version in onNotebookChange
// Insert text in a notebook cell
notebookListener.insertText(cell, pos, text)

// Remove text from a notebook cell
notebookListener.removeText(cell, pos, text)

// Insert a new notebook cell
notebookListener.insertCell(index, newCell)

// Remove a notebook cell
notebookListener.removeCell(index, oldCell)

// Move a notebook cell to a new position
notebookListener.moveCell(oldIndex, newIndex)

Example implementation https://github.com/yunluyl/realtime-notebook-client-web-example

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago