constoverrideCallback: WorkspacePlatform.WorkspacePlatformOverrideCallback = async ( WorkspacePlatformProvider ) => { classOverrideextendsWorkspacePlatformProvider { // Override the default behavior of updateSavedPage updateSavedPage = async (req: UpdateSavedPageRequest): Promise<void> => { console.log(`saving page ${req.page.pageId}`); // calling custom function to the save page here };
// add a custom menu item in Global Context Menu openGlobalContextMenu(req: WorkspacePlatform.OpenGlobalContextMenuPayload, callerIdentity: any) { returnsuper.openGlobalContextMenu( { ...req, template: [ ...req.template, { label:'Sample custom global option', data: { type:GlobalContextMenuOptionType.Custom, action: { // This action needs to be registered in customActions property in the call WorkspacePlatform.init id:'sample-custom-global-menu-action' } } } ] }, callerIdentity ); }
// add a custom menu item in View Tab Context Menu openViewTabContextMenu = async (payload: OpenViewTabContextMenuPayload, callerIdentity) => { constviewsInfo = awaitPromise.all(payload.selectedViews.map(async (v) =>fin.View.wrapSync(v).getInfo()));
Extend or replace default functionality in order to customize behavior of a Workspace Platform Provider.
To implement your own handlers for Workspace Platform behavior, extend the provided class and override any methods you'd like to alter.