in rhino/src/main/java/org/mozilla/javascript/typedarrays/NativeDataView.java [39:214]
public static Object init(Context cx, Scriptable scope, boolean sealed) {
LambdaConstructor constructor =
new LambdaConstructor(
scope,
CLASS_NAME,
1,
LambdaConstructor.CONSTRUCTOR_NEW,
NativeDataView::js_constructor);
constructor.setPrototypePropertyAttributes(DONTENUM | READONLY | PERMANENT);
constructor.definePrototypeProperty(
cx,
"buffer",
(Scriptable thisObj) -> realThis(thisObj).arrayBuffer,
DONTENUM | READONLY);
constructor.definePrototypeProperty(
cx,
"byteLength",
(Scriptable thisObj) -> realThis(thisObj).byteLength,
DONTENUM | READONLY);
constructor.definePrototypeProperty(
cx,
"byteOffset",
(Scriptable thisObj) -> realThis(thisObj).offset,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"getFloat32",
1,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) ->
realThis(thisObj).js_getFloat(4, args),
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"getFloat64",
1,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) ->
realThis(thisObj).js_getFloat(8, args),
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"getInt8",
1,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) ->
realThis(thisObj).js_getInt(1, true, args),
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"getInt16",
1,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) ->
realThis(thisObj).js_getInt(2, true, args),
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"getInt32",
1,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) ->
realThis(thisObj).js_getInt(4, true, args),
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"getUint8",
1,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) ->
realThis(thisObj).js_getInt(1, false, args),
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"getUint16",
1,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) ->
realThis(thisObj).js_getInt(2, false, args),
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"getUint32",
1,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) ->
realThis(thisObj).js_getInt(4, false, args),
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"setFloat32",
2,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) -> {
realThis(thisObj).js_setFloat(4, args);
return Undefined.instance;
},
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"setFloat64",
2,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) -> {
realThis(thisObj).js_setFloat(8, args);
return Undefined.instance;
},
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"setInt8",
2,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) -> {
realThis(thisObj).js_setInt(1, true, args);
return Undefined.instance;
},
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"setInt16",
2,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) -> {
realThis(thisObj).js_setInt(2, true, args);
return Undefined.instance;
},
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"setInt32",
2,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) -> {
realThis(thisObj).js_setInt(4, true, args);
return Undefined.instance;
},
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"setUint8",
2,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) -> {
realThis(thisObj).js_setInt(1, false, args);
return Undefined.instance;
},
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"setUint16",
2,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) -> {
realThis(thisObj).js_setInt(2, false, args);
return Undefined.instance;
},
DONTENUM,
DONTENUM | READONLY);
constructor.definePrototypeMethod(
scope,
"setUint32",
2,
(Context lcx, Scriptable lscope, Scriptable thisObj, Object[] args) -> {
realThis(thisObj).js_setInt(4, false, args);
return Undefined.instance;
},
DONTENUM,
DONTENUM | READONLY);
if (sealed) {
constructor.sealObject();
}
return constructor;
}