my.canIUse(String)
This API is supported in mPaaS 10.1.32 and later versions.
This interface is used to determine whether the current version supports the API, input parameters or return values, components, attributes, etc. of the current MINI.
Input parameter
The parameters are called by the ${API}.${type}.${param}.${option}
or ${component}.${attribute}.${option}
method.
- API: Indicates the API name, exclude the name of
my.
. For example: if you want to judgemy.getFileInfo
, you only need to pass ingetFileInfo
. - type: Possible values are object/return/callback, which indicates the judgment type of the API.
- param: Indicates an attribute name of the parameter.
- option: Indicates the specific attribute value of the parameter attribute.
- component: Indicates the component name.
- attribute: Indicates the component attribute name.
- option: Indicates the component attribute value.
Code sample
// Whether the new API is available
my.canIUse('getFileInfo')
// Whether the new API attribute is available
my.canIUse('closeSocket.object.code')
// Whether the new API attribute is available
my.canIUse('getLocation.object.type')
// Whether the new attribute of the API return value is available
my.canIUse('getSystemInfo.return.brand')
// Whether the new component "Follow lifestyle account" is available
my.canIUse('lifestyle')
// Whether the new attribute value of the component is available
my.canIUse('button.open-type.share')
Return value
Boolean type, indicating whether it is supported.