Appearance
Other
onCustomEvent
onCustomEvent(callback)
Listen to the native "onCustomEvent" event.
Sample Code
javascript
const callback = (res) => {
console. log(res) gets the parameters passed natively
}
ft. onCustomEvent(callback)
offCustomEvent
offCustomEvent(callback)
Unlisten for the onCustomEvent event. When the callback is empty, clear all callbacks
Sample Code
javascript
const callback = (res) => {}
ft. onCustomEvent(callback)
Clears the specified callback
ft. offCustomEvent(callback)
Clear all callbacks
ft. offCustomEvent()
addCustomEventListener
addCustomEventListener(eventName, callback)
This event is based of onCustomEvent, which can effectively reduce template code within onCustomEvent
attention When using this event, to trigger it normally, the SDK must have a name field in the data body when calling the event, indicating which eventName was triggered.
例如:
javascript
{
name: 'someMethod', // required
data: {
a: 'data-1',
b: 'data-2',
c: 1001
},
errMsg: 'some error msg'
}
The overall data will be transmitted to the callback
example code
javascript
const callback = (res) => {
console.log(res);
};
ft.addCustomEventListener("someMethod", callback);
removeCustomEventListener
removeCustomEventListener(eventName, callback)
Remove the listening of addCustomEventListener
example code
javascript
const callback = (res) => {
console.log(res);
};
ft.removeCustomEventListener("someMethod", callback);
getSuperviseInfo
Obtain monitoring information.
getSuperviseInfo(Object object)
Description
When invoking this interface, ensure that the SDK version integrated in the App is later than the following version:
Android SDK version: 2.8.55
iOS SDK version: 2.4.9
parameter
Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
success | function | no | Interface calls the successful callback function | |
fail | function | no | Interface calls failed callback functions | |
complete | function | no | Callback function at the end of an interface call (both successful and unsuccessful calls are executed) |
object.success callback function
parameter
Object res
attribute | type | Introductions |
---|---|---|
idfv | string | idfv |
imei | string | imei |
udid | string | Equipment unique identification |
registerMobile | string | Registered mobile phone number |
actualMobile | string | Actually use the phone number |
publicIp | string | Public ip address |
publicPort | string | Public network port number |
macAddress | string | mac address |
innerIp | string | Intranet ip |
systemVersion | string | System version number |
imsi | string | imsi |
iccid | string | iccid |
appName | string | Application name |
appVersion | string | Application version number |
bundleId | string | bundleId of the application |
sample code
javascript
ft.getSuperviseInfo({
success(res) {
console.log(res.idfv);
console.log(res.imei);
console.log(res.appName);
console.log(res.appVersion);
},
});
sendWebviewEvent
ft.sendWebviewEvent(Object object, Object pageInstance)
The mini program sends events to H5
sample code
javascript
ft.sendWebviewEvent({ data: "456" }); // Send data to the current page
ft.sendWebviewEvent({ data: "456" }, getCurrentPages()[0]); // Send data to the corresponding page
reportEvent
事件上报
ft.reportEvent(string eventId, object data)
参数
attribute | type | Introductions |
---|---|---|
eventId | string | Unique event name that is set |
data | object | Be JSON.stringily Will be reported to the system together |
loadExtApi
loadExtApi(Object object)
Load custom API configuration, equivalent to FinClipConf.js configuration.
SDK configuration document reference:
IOS Custom API Configuration Document
Android Custom API Configuration Document
There are two ways to configure custom APIs:
Create a 'FinClipConf. js' file through the root directory
Through the ft.loadExtApi API
The parameters used for both are consistent
参数
单个 API 项目的参数如下
attribute | type | required | Introductions |
---|---|---|---|
name | string | true | API name |
sync | boolean | false | Is it a synchronization API |
params | object | false | Parameter format, which can only list necessary attributes. If there are no restrictions, empty objects can be used directly |
示例代码
js
// FinClipConf.js
module.exports = {
extApi: [
{
name: "finclipLogin",
sync: false,
params: {
url: "",
},
},
],
};
示例代码
javascript
// loadExtApi and FinClipConf.js param are same
ft.loadExtApi([
{
name: 'finclipLogin',
sync: false,
params: {
url: ''
}
},
{
name: 'finclipTestSync',
sync: true,
params: {
name:'',
title:''
}
}
])
// sync invoke
ft.finclipLogin({
url: 'some url'
success: (res) => { console.log(res) },
fail: (res) => { console.log(res) },
})
// async invoke
const res = ft.finclipTestSync({ name: '', title: ''})
console.log(res)