Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion packages/blockly/core/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/blockly/core/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class Workspace {
this.listeners.length = 0;
this.clear();
// Remove from workspace database.
common.unregisterWorkpace(this);
common.unregisterWorkspace(this);
}

/**
Expand Down
11 changes: 11 additions & 0 deletions packages/blockly/scripts/migration/renamings.json5
Original file line number Diff line number Diff line change
Expand Up @@ -1595,5 +1595,16 @@
},
],

'13.0.0': [
{
oldName: 'Blockly.common',
exports: {
unregisterWorkpace: {
newExport: 'unregisterWorkspace',
},
},
},
],

'develop': [],
}