1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-10-14 06:51:58 +00:00

Tab-completion is in its own file now (which I accidentally added in a previous commit). Update fine's searchParent and searchTree to accept the name of a FineWrapper to use that class.

This commit is contained in:
SirStendec 2018-04-07 19:10:45 -04:00
parent 79851ef609
commit f77371d8fb
2 changed files with 24 additions and 87 deletions

View file

@ -148,6 +148,17 @@ export default class Fine extends Module {
if ( ! node || depth > max_depth )
return null;
if ( typeof criteria === 'string' ) {
const wrapper = this._wrappers.get(criteria);
if ( ! wrapper )
throw new Error('invalid critera');
if ( ! wrapper._class )
return null;
criteria = n => n && n.constructor === wrapper._class;
}
const inst = node.stateNode;
if ( inst && criteria(inst) )
return inst;
@ -172,6 +183,17 @@ export default class Fine extends Module {
if ( ! node || depth > max_depth )
return null;
if ( typeof criteria === 'string' ) {
const wrapper = this._wrappers.get(criteria);
if ( ! wrapper )
throw new Error('invalid critera');
if ( ! wrapper._class )
return null;
criteria = n => n && n.constructor === wrapper._class;
}
const inst = node.stateNode;
if ( inst && criteria(inst) )
return inst;