Installation
How to use @otjs packages in your project.
“Life is really simple, but we insist on making it complicated.” ― Confucius
All installation script in this document are using pnpm as package manager. Kindly check the compatible commands and options, in case you are using any other package manager and/or runtime.
🚀 Quickstart
More often than not all you need is to synchronise your coding workspaces. For that, @otjs comes with two out of the box packages, namely - @otjs/firebase-ace and @otjs/firebase-monaco for Ace and Monaco editor respectively.
pnpm add @otjs/firebase-ace
or
pnpm add @otjs/firebase-monaco
🔑 Usage
Given these packages come batteries included, they only require few configuration, and all set to synchronise.
- For
@otjs/firebase-ace:
import { FireAceEditor } from "@otjs/firebase-ace";
const fireAce = new FireAceEditor({
databaseRef: // Database Reference in Firebase Realtime DB
editor: // Ace Editor instance
announcementDuration: // Duration to hide Cursor tooltip (optional)
userId: // Unique Identifier for current user
userColor: // Unique Color Code for current user
userName: // Human readable Name or Short Name (optional)
});
- For
@otjs/firebase-monaco:
import { FireMonacoEditor } from "@otjs/firebase-monaco";
const fireMonaco = new FireMonacoEditor({
databaseRef: // Database Reference in Firebase Realtime DB
editor: // Monaco Editor instance
announcementDuration: // Duration to hide Cursor tooltip (optional)
userId: // Unique Identifier for current user
userColor: // Unique Color Code for current user
userName: // Human readable Name or Short Name (optional)
});
⭐ Examples
| Example | Sandbox (WIP) | Playground | Description | |
|---|---|---|---|---|
Complete working example with Ace Editor and Firebase Database using | ||||
Complete working example with Monaco Editor and Firebase Database using | ||||
📦 Packages
There are multiple packages published under @otjs namespace and each have a shared responsibility in building the whole system.
@otjs/ace
Editor Adapter for Ace Editor by Cloud9.
@otjs/firebase-ace
Plaintext Editor with in-built binding for Firebase and Ace Editor.
@otjs/firebase-monaco
Plaintext Editor with in-built binding for Firebase and Monaco Editor.
@otjs/firebase-plaintext
Database Adapter for Firebase by Google Cloud.
@otjs/monaco
Editor Adapter for Monaco Editor by Microsoft.
@otjs/plaintext
Text Operation feature sets for Transformations.
@otjs/plaintext-editor
Client (Editor) implementation for Plaintext Synchronisation.
@otjs/state-machine
Database Synchronisation Toolkit.
On This Page