NativeApis.js 803 Bytes
export const NativeMethodNames = {
    AppInfoApi: 'nativeAppInfo',
    AppShare: 'nativeAppShare',
}

export const JsMethodNames = {
    PayResult: 'payResult'
}

export const JsInterfaces = objVal2Array(JsMethodNames)


export const NativeApi = {
    on: (jsMethodName, callback) => {
        $api.on(jsMethodName, callback)
    },

    call: (nativeMethodName, param, isBack) => {
        return $api.call(nativeMethodName, param, isBack)
    },

    nativeAppInfo: (param) => {
        return $api.call(NativeMethodNames.AppInfoApi, param, true)
    },

    nativeAppShare: (param) => {
        return $api.call(NativeMethodNames.AppShare, param, true)
    }
}



function objVal2Array(obj) {
    const arrays = []
    for (const key in obj) {
        arrays.push(obj[key])
    }
    return arrays
}