This small library encapsulates some logic which can be used to build custom dashboard widgets for ftrack.
We recommend installing and bundling with NPM:
npm install @ftrack/web-widget
To use the library, define two functions onWidgetLoad
and onWidgetUpdate
and initialize the library once the document is ready:
import { initialize } from "@ftrack/web-widget";
/** Initialize widget once DOM has loaded. */
window.addEventListener("DOMContentLoaded", function onDomContentLoaded() {
initialize({
onWidgetLoad: onWidgetLoad,
onWidgetUpdate: onWidgetUpdate,
});
});
If used as an UMD module, the library exposes ftrackWidget
on the global (window
) object.
For a more complete example, see ftrack JavaScript API: Basic Widget Example
More information on the API used is available in the documentation Creating a custom widget with React.