Skip to content
Merged
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
6 changes: 5 additions & 1 deletion lib/canvas_editor/init/canvas_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,18 @@ function initCanvasEditor(
this.#destroy = null;
}

get isDestroyed() {
return !this.#editorArea;
}

moleculeChanged() {
this.#checkNotDestroyed();

this.#editorArea.moleculeChanged();
}

#checkNotDestroyed() {
if (!this.#editorArea) {
if (this.isDestroyed) {
throw new Error('CanvasEditor has been destroyed');
}
}
Expand Down
5 changes: 5 additions & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3572,7 +3572,7 @@

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface IForceFieldMMFF94Options {
// TODO

Check warning on line 3575 in types.d.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO'
}

export interface IForceFieldMinimiseOptions {
Expand Down Expand Up @@ -3883,6 +3883,11 @@
* All methods will throw an error after calling this.
*/
destroy(): void;

/**
* Returns whether the editor has been destroyed.
*/
get isDestroyed(): boolean;
}

interface CanvasEditorElementModeEnum {
Expand Down
Loading