"use strict";
function _wrappedValue(v) {
switch (typeof v) {
case "number":
return {
type: "number",
value: v
};
case "string":
type: "string",
case "boolean":
type: "boolean",
case "object":
if (v instanceof Array) {
type: "array",
value: JSON.stringify(v)
}
else {
type: "object",
default:
type: "null",
value: undefined
function _rawValue(v) {
switch (v.type) {
return v.value;
case "array":
return JSON.stringify(v.value);
return undefined;
function __injectGlobalObject(name, args) {
Reflect.set(window, name, JSON.parse(args));
function __injectGlobalFunction(name) {
Reflect.set(window, name, function () {
const args = [];
for (let i = 0; i < arguments.length; i++) {
args.push(_wrappedValue(arguments[i]));
const ret = NativeClient.callNative(name, JSON.stringify(args));
return _rawValue(JSON.parse(ret));
});