0.0.9 • Published 4 years ago

agora-office v0.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

AgoraOfficeViewer

A typescript library allowing anyone to quickly render office files in their page with all actions synced across all the users

Installation:

npm i agora-office

Usage

You can take a look at a sample app built using this library here

Documentation

AgoraOffice(backendUrl: string, channel: RtmChannel, iframe: HTMLIFrameElement)

Creates a new AgoraOffice Client Object.
backendUrl: It is the url pointing to your backend
channel: It is an RtmChannel object. You can see how to create that here
iframe: Reference to the iframe where you want the document to be rendered

setRole(role: Role)

Sets whether the office client should behave as a broacaster or receiver.
The receiver is always synced to the broadcaster. Example: In a word document the scroll position of the receiver would be in sync with the scroll position of the broadcaster
Important: There can be only 1 broadcaster

role: The role can be set as a broacaster or receiver.

  • Role.Broadcaster
  • Role.Receiver

loadDocument(fileUrl: URL): Promise

fileUrl: The URL of the document to be loaded into the iframe
Returns a promise that resolves when the document is done loading

syncDocument()

Starts the syncing of the documents.
If this method is not called for a particular receiver, the syncing will not work only for that receiver.
If this method is not called for the broadcaster, syncing will not work.

stopSync()

Stops the syncing.
Calling this method for a particular receiver, stops the sync only for that receiver
Calling this method for the broadcaster, stops the sync for everyone

renderFilePickerUi(): Promise

Renders a file picker UI inside the iframe. It uploads the file to the backend. It is a helper function in case the user does not want to build their own file picker mechanism. Uses Dropzone internally.
The promise resolves after the file is uploaded and returns a URL of the file which can then be passed into the loadDocument() function

0.0.9

4 years ago

0.0.8

4 years ago

0.0.5

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago