# boolean wx.canIUse(string schema)

Start from base library version 1.1.1. Please remaining backward compatible.

with Promise style call: Not supported

Mini Program plugin: Not supported

Determine if Mini Programs' APIs, callbacks, parameters, components, etc are available in the current version.

# parameter

# string schema

Use ${API}.${method}.${param}.${option} or ${component}.${attribute}.${option} Method to call

# Return value

# boolean

Current version available

# Parameter specification

  • ${API} representative API name
  • ${method} Represents the method of invocation with a valid value of return, success, object, callback
  • ${param} Represents a parameter or return value
  • ${option} A property representing the optional or return value of a parameter
  • {\ component}} Represents component name
  • ${attribute} Representing component properties
  • ${option} Optional values representing component properties

# sample code

// Property or method of an object
wx.canIUse('console.log')
wx.canIUse('CameraContext.onCameraFrame')
wx.canIUse('CameraFrameListener.start')
wx.canIUse('Image.src')

// Wx interface parameter, callback, or return value
wx.canIUse('openBluetoothAdapter')
wx.canIUse('getSystemInfoSync.return.safeArea.left')
wx.canIUse('getSystemInfo.success.screenWidth')
wx.canIUse('showToast.object.image')
wx.canIUse('onCompassChange.callback.direction')
wx.canIUse('request.object.method.GET')

// Properties of components
wx.canIUse('live-player')
wx.canIUse('text.selectable')
wx.canIUse('button.open-type.contact')