File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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+ }
Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments