Design Jan 04
The Uniboard Apps API implements the W3C Widget API, and defines an extra object "uniboard" which provides a basic API to interact with Uniboard. You can use this API to embed web services, interactive elements or to expand the default Uniboard properties.
The "widget" object as defined by the W3C: http://www.w3.org/TR/widgets-apis
Attributes
| Attribute | Return value | Description |
|---|---|---|
| pageCount | Number | Reference of the total number of pages of the current Uniboard document. |
| currentPageNumber | Number | Reference of the active page number within the current Uniboard document. |
Methods
| Method | Return value | Description |
|---|---|---|
| setTool(tool) | None | Set the current tool ('pen', 'marker', 'arrow', 'line') |
| setPenColor(color) | None | Set the current color, an HTML color (red, blue, ...) or rgb (#FF0000) or a default Uniboard color (1, 2, 3, 4) |
| setMarkerColor(color) | None | Set the current color, an HTML color (red, blue, ...) or rgb (#FF0000) or a default Uniboard color (1, 2, 3, 4) |
| moveTo(x, y) | None | Move the drawing control to x, y |
| drawLineTo(x, y, width) | None | Draw to x, y with the given width |
| eraseLineTo(x, y, width) | None | Erase to x, y with the given width |
| clear() | None | Remove all items (drawings, objects) from scene |
| addObject(url, width, height, x, y) | None | Add a URL at the given position |
| addText(text, x, y) | None | Add a textfield at the given position |
| setBackground(dark, grid) | None | Set the background (black/white) with or without grid |
| Board | ||
| zoom(factor, x, y) | None | Zoom the view of factor, the transformation centered on x, y |
| centerOn(x, y) | None | Center the view on scene coordinates x, y |
| pageThumbnail(pageNumber) | String | Return the url of the thumbnail of a page |
| showMessage(message) | None | display a message on the bottom left corner of the board |
| State Persistence | ||
| datastore.document | None | A Web Storage object (http://www.w3.org/TR/webstorage/#the-storage-interface) |
| Inter Application Messages | ||
| messages.subscribeToTopic(topicName) | None | register the App to a given topic |
| messages.unsubscribeFromTopic(topicName) | None | unregister the App from a given topic |
| messages.sendMessage(topicName, message) | None | Send a message on a specific topic |
| messages.onNewMessage(topicName, message) | None | Callback when a new message is delivered on a registered topic |