{
console.log('Recording started successfully:', res);
},
onFail: (err) => {
console.error('Failed to start recording:', err);
}
});
```
--------------------------------
### Get Performance Data using JavaScript
Source: https://developers.binance.com/docs/mini-program/framework/api/basics/getPerformance
Retrieves performance information using the `bn.getPerformance` function. This function returns a `Performance` object, which can then be used to get all current performance entries. The entries provide detailed metrics about various aspects of the mini-program's execution.
```javascript
const performance = bn.getPerformance()
const entries = performance.getEntries()
console.log(entries)
```
--------------------------------
### Textarea Component Example with CSS Styling
Source: https://developers.binance.com/docs/mini-program/framework/components/TextArea
This example demonstrates how to use the Textarea component and apply custom styling, specifically for the caret color, using a CSS class. It highlights the recommended approach for modifying caret color via CSS instead of inline styles.
```html
```
--------------------------------
### Listen for Theme Switching Events in Binance Mini-Program
Source: https://developers.binance.com/docs/mini-program/framework/configuration
Provides two methods to monitor theme changes: by defining an onThemeChange callback in App() or by using bn.onThemeChange. The monitoring can be cancelled with bn.offThemeChange.
```javascript
// Method 1: In App()
App({
onThemeChange(theme) {
console.log('Theme changed to:', theme);
}
});
```
```javascript
// Method 2: Using bn.onThemeChange
bn.onThemeChange(theme => {
console.log('Theme changed to:', theme);
});
// To cancel monitoring:
bn.offThemeChange();
```
--------------------------------
### BNS Module Definition and Event Binding Example
Source: https://developers.binance.com/docs/mini-program/framework/bns
This example demonstrates how to define BNS modules within `