Skip to content

Commit 4e8bb98

Browse files
committed
Revert "chore: Remove unused isFocusable*() functions."
This reverts commit 404c20e.
1 parent c91fed3 commit 4e8bb98

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

core/interfaces/i_focusable_node.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,20 @@ export interface IFocusableNode {
6060
*/
6161
onNodeBlur(): void;
6262
}
63+
64+
/**
65+
* Determines whether the provided object fulfills the contract of
66+
* IFocusableNode.
67+
*
68+
* @param object The object to test.
69+
* @returns Whether the provided object can be used as an IFocusableNode.
70+
*/
71+
export function isFocusableNode(object: any | null): object is IFocusableNode {
72+
return (
73+
object &&
74+
'getFocusableElement' in object &&
75+
'getFocusableTree' in object &&
76+
'onNodeFocus' in object &&
77+
'onNodeBlur' in object
78+
);
79+
}

core/interfaces/i_focusable_tree.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,22 @@ export interface IFocusableTree {
119119
*/
120120
onTreeBlur(nextTree: IFocusableTree | null): void;
121121
}
122+
123+
/**
124+
* Determines whether the provided object fulfills the contract of
125+
* IFocusableTree.
126+
*
127+
* @param object The object to test.
128+
* @returns Whether the provided object can be used as an IFocusableTree.
129+
*/
130+
export function isFocusableTree(object: any | null): object is IFocusableTree {
131+
return (
132+
object &&
133+
'getRootFocusableNode' in object &&
134+
'getRestoredFocusableNode' in object &&
135+
'getNestedTrees' in object &&
136+
'lookUpFocusableNode' in object &&
137+
'onTreeFocus' in object &&
138+
'onTreeBlur' in object
139+
);
140+
}

0 commit comments

Comments
 (0)