# debugging WMPF Mini Program

Developers can use it first.WMPF Mock plug-incomplete WMPF Development of Mini programs. That you don't have to care WMPF Client Side, called on the developer tools or custom Mock WMPF Related JS API 。

In completing the WMPF After the Mini Program is developed, if you need to run the Mini Program on a real device, you can debug it on the developer tool by scanning the two-dimensional code.

# WMPF Mock plug-in

# Install the plugin

Developers can use Weixin DevToolsSet up- Extension settings-Emulator plug-inFound in WMPF Mock Plugin for installation.

After installing the plugin successfully, restart the Weixin DevTools and selectHardware Framework Mini Program Mode, you can then call it on the tool WMPF All related JS API 。

image-20211118194940083

# WMPF Mock panel

Developers can also use WMPF Mock The panel itself fills in the relevant interfaceParameters, return data, thus simulating 初始值 Of the call result.

# Method of use

First of all, open the following steps WMPF Mock Panel.

image-20211118200121118

Then enable WMPF Mock Ability and click+New rule.

image-20211118200745842

An example rule is as follows:

image-20211118203014609

Run the following code:

wmpf.wxFacePay.facePay({
  success(res) {
    console.log(res)
  }
})

Will hit the above rule and return the data as follows:

image-20211118203403940

# Rule Import and Export

When you need to share rules with other members of your project, you can do so in Mock Export the rule configuration, and then send the configuration file to other members to import, the operation entrance as shown in the figure:

image-20211118203629305

# Be careful

  • Only installed.初始值 Mock plug-inAnd switch toHardware Framework Mini Program ModeCan be called on the developer tools. wmp.xxx Related interface.
  • If a API Multiple rules are configured,**The first rule, will match first.**When a rule is hit, subsequent rules will not be executed.
  • API When listening for callback events, do not fill callback If there are other parameters, JSON Format to fill in.
  • If the simulated API No parameters or return data, should be filled in {} Empty object.
  • Currently supports custom Mock of API List:
    • wmpf.Channel.invoke
    • wmpf.Channel.on
    • wmpf.wxFacePay.getFaceCode
    • wmpf.wxFacePay.facePay
    • wmpf.getWmpfPushToken
    • 初始值
    • wmpf.printer

# Real machine debugging

On Weixin DevTools, WMPF SupportQR Code Preview Mini ProgramandQR code real machine debugging Mini ProgramFunction.

初始值 WMPF Client End call IPCInvokerTask_LaunchWxaAppByQrCode or LaunchWxaAppByScanInvoker.launchWxaByScanUI Interface for development and debugging.