Global

Methods

array(val, defaultValueopt) → {Array}

Array utility functions
Parameters:
Name Type Attributes Description
val T | Array | null | undefined
defaultValue T <optional>
Source:
Returns:
Type
Array

getConfigFromDataSource(dataSource) → {Object}

Maps configuration data into various lookup objects
Parameters:
Name Type Description
dataSource DataTupleDataSource Source data array
Source:
Returns:
Object containing various mappings of the data
Type
Object
Example
```ts
const data = [
  [1, 'A', '文案A'],
  [2, 'B', '文案B']
] as const;
const result = getConfigFromDataSource(data);
// result = {
//   valueMapByKey: { A: 1, B: 2 },
//   keyMapByValue: { 1: 'A', 2: 'B' },
//   nameMapByValue: { 1: '文案A', 2: '文案B' },
//   nameMapByKey: { A: '文案A', B: '文案B' }
// }
```

getNetWorkInfo() → {object}

Retrieves the current network status and connection information of the user's device.
Source:
Returns:
An object containing network status and, if online, additional connection details: - `status`: `"online"` or `"offline"`. - `type` (optional): The effective type of the connection (e.g., '4g', '3g', etc.). - `rtt` (optional): The estimated effective round-trip time of the current connection, in milliseconds. - `downlink` (optional): The effective bandwidth estimate in megabits per second.
Type
object

Type Definitions

DataTupleIndex

Index types for data tuple
Type:
  • 0 | 1 | 2
Source: