object property

JSObject get object

Converts a JavaScript value to object and returns the resulting object. exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.

Implementation

JSObject get object {
  if (_obj != null) return _obj!;
  final JSException exception = JSException.create(context);
  final JSObjectRef objectRef = JSValueToObject(
    context.ref,
    _ref,
    exception.ref,
  );
  if (exception.shouldThrow) throw exception.error;
  _obj = JSObject(context, objectRef, autoDispose: false);
  return _obj!;
}