added inspect to perf

This commit is contained in:
Djeeberjr 2023-06-04 21:29:02 +02:00
parent fd2b53167e
commit d0c01800a6

View File

@ -54,6 +54,25 @@ class Peripheral {
return addr; return addr;
} }
public function inspect(addr: String): Null<{ types: Array<String>, methods: Array<String>}> {
if (!isPresent(addr)) {
return null;
}
var types = getTypes(addr);
var methodsMap = cc.Peripheral.getMethods(addr).toArray();
var methods: Array<String> = [];
for (method in methodsMap) {
methods.push(method);
}
return {
types: types,
methods: methods
};
}
public function getScreen(addr: String): Null<Screen> { public function getScreen(addr: String): Null<Screen> {
var addr = safeGetAddr(addr, Screen.TYPE_NAME); var addr = safeGetAddr(addr, Screen.TYPE_NAME);
if (addr == null) return null; if (addr == null) return null;