mirror of
https://github.com/google/blockly.git
synced 2026-01-31 04:30:11 +01:00
Revert "chore: Remove unused isFocusable*() functions."
This reverts commit 404c20eeaf.
This commit is contained in:
@@ -60,3 +60,20 @@ export interface IFocusableNode {
|
||||
*/
|
||||
onNodeBlur(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the provided object fulfills the contract of
|
||||
* IFocusableNode.
|
||||
*
|
||||
* @param object The object to test.
|
||||
* @returns Whether the provided object can be used as an IFocusableNode.
|
||||
*/
|
||||
export function isFocusableNode(object: any | null): object is IFocusableNode {
|
||||
return (
|
||||
object &&
|
||||
'getFocusableElement' in object &&
|
||||
'getFocusableTree' in object &&
|
||||
'onNodeFocus' in object &&
|
||||
'onNodeBlur' in object
|
||||
);
|
||||
}
|
||||
|
||||
@@ -119,3 +119,22 @@ export interface IFocusableTree {
|
||||
*/
|
||||
onTreeBlur(nextTree: IFocusableTree | null): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the provided object fulfills the contract of
|
||||
* IFocusableTree.
|
||||
*
|
||||
* @param object The object to test.
|
||||
* @returns Whether the provided object can be used as an IFocusableTree.
|
||||
*/
|
||||
export function isFocusableTree(object: any | null): object is IFocusableTree {
|
||||
return (
|
||||
object &&
|
||||
'getRootFocusableNode' in object &&
|
||||
'getRestoredFocusableNode' in object &&
|
||||
'getNestedTrees' in object &&
|
||||
'lookUpFocusableNode' in object &&
|
||||
'onTreeFocus' in object &&
|
||||
'onTreeBlur' in object
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user