getOwnPropertyNames method
Implementation
(List<JSPropertyEnum>?, int?) getOwnPropertyNames({JSGN? flags}) {
Pointer<JSPropertyEnumRef> ptab = calloc.call<JSPropertyEnumRef>(
sizeOf<JSPropertyEnumRef>(),
);
flags ??= JSGN.STRING | JSGN.ENUM_ONLY;
final plen = calloc.call<Uint32>(sizeOf<Uint32>());
int count = 0;
List<JSPropertyEnum> properts = [];
Console.info('getOwnPropertyNames: isObject=$isObject $string');
try {
final ret = JS_GetOwnPropertyNames(
_ctx.ref,
ptab,
plen,
_ref.ref,
flags.value,
);
Console.info(
'[getOwnPropertyNames] $ret ${plen.value}, ${_ctx.exception.toCString}',
);
// maybe throw not a object error
if (ret < 0) return (null, null);
count = plen.value;
for (int i = 0; i < count; i++) {
properts.add(JSPropertyEnum.raw(ptab[i]));
}
} finally {
calloc.free(plen);
}
return (properts, count);
}