Skip to content

Other

onCustomEvent

onCustomEvent(callback)

Listen to the native "onCustomEvent" event.

ios Calling method

android Calling method

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

attributetypeDefault valuesRequiredIntroductions
successfunctionnoInterface calls the successful callback function
failfunctionnoInterface calls failed callback functions
completefunctionnoCallback function at the end of an interface call (both successful and unsuccessful calls are executed)

object.success callback function

parameter

Object res

attributetypeIntroductions
idfvstringidfv
imeistringimei
udidstringEquipment unique identification
registerMobilestringRegistered mobile phone number
actualMobilestringActually use the phone number
publicIpstringPublic ip address
publicPortstringPublic network port number
macAddressstringmac address
innerIpstringIntranet ip
systemVersionstringSystem version number
imsistringimsi
iccidstringiccid
appNamestringApplication name
appVersionstringApplication version number
bundleIdstringbundleId 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)

参数

attributetypeIntroductions
eventIdstringUnique event name that is set
dataobjectBe 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:

  1. Create a 'FinClipConf. js' file through the root directory

  2. Through the ft.loadExtApi API

The parameters used for both are consistent

参数

单个 API 项目的参数如下

attributetyperequiredIntroductions
namestringtrueAPI name
syncbooleanfalseIs it a synchronization API
paramsobjectfalseParameter 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)