diff --git a/core/common.ts b/core/common.ts index 7f23779ec93..b67dfac8da7 100644 --- a/core/common.ts +++ b/core/common.ts @@ -15,6 +15,7 @@ import * as eventUtils from './events/utils.js'; import {getFocusManager} from './focus_manager.js'; import {ISelectable, isSelectable} from './interfaces/i_selectable.js'; import {ShortcutRegistry} from './shortcut_registry.js'; +import { deprecation } from './utils.js'; import type {Workspace} from './workspace.js'; import type {WorkspaceSvg} from './workspace_svg.js'; @@ -58,10 +59,27 @@ export function registerWorkspace(workspace: Workspace) { * * @param workspace */ -export function unregisterWorkpace(workspace: Workspace) { +export function unregisterWorkspace(workspace: Workspace) { delete WorkspaceDB_[workspace.id]; } +/** + * Unregister a workspace from the workspace db. + * + * @deprecated v12: use Blockly.common.unregisterWorkspace + * @param workspace + */ +export function unregisterWorkpace(workspace: Workspace) { + deprecation.warn( + 'Blockly.common.unregisterWorkpace', + 'v12', + 'v13', + 'Blockly.common.unregisterWorkspace', + ); + + unregisterWorkspace(workspace); +} + /** * The main workspace most recently used. * Set by Blockly.WorkspaceSvg.prototype.markFocused diff --git a/scripts/migration/renamings.json5 b/scripts/migration/renamings.json5 index 9c51b2d4a3f..5e11e1c94c2 100644 --- a/scripts/migration/renamings.json5 +++ b/scripts/migration/renamings.json5 @@ -1595,5 +1595,16 @@ }, ], + '13.0.0': [ + { + oldName: 'Blockly.common', + exports: { + unregisterWorkpace: { + newExport: 'unregisterWorkspace', + }, + }, + }, + ], + 'develop': [], }