When initializing the SDK frame, a number of events can be passed to the configuration, which will be executed at the appropriate moment:
onAppError - the function called when SDK is initialized with an error. This error is returned during the initialization.
var onAppError = function () { console.log("ONLYOFFICE DocSpace reports an error"); }; var docSpace = new DocSpace.SDK.initManager({ "events": { "onAppError": null, ... }, ... });
onAppReady - the function called when SDK is initialized successfully.
var onAppReady = function () { console.log("ONLYOFFICE DocSpace is ready"); }; var docSpace = new DocSpace.SDK.initManager({ "events": { "onAppReady": null, ... }, ... });
onCloseCallback - the function called only in the room-selector and file-selector modes when the room or file selector is closed or the selection is canceled.
var onCloseCallback = function () { console.log("The room selector is closed."); }; var docSpace = new DocSpace.SDK.initRoomSelector({ "events": { "onCloseCallback": null, ... }, ... });
onSelectCallback - the function called only in the room-selector and file-selector modes when a room or file is selected.
var onSelectCallback = function () { console.log("The 'New room' room was selected."); }; var docSpace = new DocSpace.SDK.initRoomSelector({ "events": { "onSelectCallback": null, ... }, ... });
The information about the selected item is returned:
{ "icon": "https://example.com/url-to-example-image.svg", "id": 34, "isSelected": false, "label": "roomName" }
where example.com is the name of the server with the ONLYOFFICE DocSpace installed.
Parameter | Description | Type | Presence |
icon | Defines the URL to the room/file icon. | string | required |
id | Defines the room/file ID. | integer | required |
isSelected | Specifies whether the current room/file is selected. | boolean | required |
label | Defines the room/file label. | string | required |