Files
blockly/core/interfaces/i_selectable.ts
Beka Westberg abfbbbc299 fix!: various drag-adjacent interfaces (#7975)
* fix: ISelectable and IDeletable interfaces

* fix: switch everything over to use new draggable interface

* fix: exports
2024-03-29 21:00:56 +00:00

30 lines
643 B
TypeScript

/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Former goog.module ID: Blockly.ISelectable
/**
* The interface for an object that is selectable.
*/
export interface ISelectable {
id: string;
/** Select this. Highlight it visually. */
select(): void;
/** Unselect this. Unhighlight it visually. */
unselect(): void;
}
/** Checks whether the given object is an ISelectable. */
export function isSelectable(obj: Object): obj is ISelectable {
return (
typeof (obj as any).id === 'string' &&
(obj as any).select !== undefined &&
(obj as any).unselect !== undefined
);
}