Basic Capabilities
console
Print logs to the debug panel. console is a global object that can be accessed directly. In the client, logs are output to vConsole.
Method
Print debug logs to the debug panel
Print log logs to the debug panel
Print info logs to the debug panel
Print warn logs to the debug panel
Print error logs to the debug panel
Create a new group in the debug panel. The content output later will be added with an indent, indicating that the content belongs to the current group. The group ends after calling console.groupEnd.
End the group created by console.group
Notes
Due to the limited functionality of vConsole and the different support for console methods by different clients, it is recommended that developers only use the methods provided in this document in mini-programs.
Timer
setTimeout
The API usage is as follows: number setTimeout(function callback, number delay, any rest)
Functional description: Set a timer. Execute the registered callback function after the timer expires.
Parameters and descriptions:
- function callback, callback function;
- number delay, delay time, the function call will occur after the delay, unit ms;
- any rest, param1, param2, ..., paramN and other additional parameters, they will be passed as parameters to the callback function.
Return value: number, the number of the timer, this value can be passed to clearTimeout to cancel the timer
clearTimeout
The API usage is as follows: clearTimeout(number timeoutID)
Functional description: Cancel the timer set by setTimeout
Parameters and descriptions: number timeoutID, the ID of the timer to be canceled.
setInterval
The API usage is as follows: number setInterval(function callback, number delay, any rest)
Functional description: Set a timer. Execute the registered callback function according to the specified period (in milliseconds).
Parameters and descriptions:
- function callback, callback function;
- number delay, the time interval between executing the callback function, unit ms;
- any rest, param1, param2, ..., paramN and other additional parameters, they will be passed as parameters to the callback function.
Return value: number, the number of the timer, this value can be passed to clearInterval to cancel the timer.
clearInterval
The API usage is as follows: clearInterval(number intervalID)
Functional description: Cancel the timer set by setInterval.
Parameters and descriptions: number intervalID, the ID of the timer to be canceled.