angular-toolbox 0.9.5 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -6
- package/esm2022/lib/model/business/index.mjs +2 -1
- package/esm2022/lib/model/business/navigator/battery-manager.mjs +9 -0
- package/esm2022/lib/model/business/navigator/connection-type.mjs +9 -0
- package/esm2022/lib/model/business/navigator/effective-connection-type.mjs +9 -0
- package/esm2022/lib/model/business/navigator/index.mjs +5 -0
- package/esm2022/lib/model/business/navigator/network-information.mjs +9 -0
- package/esm2022/lib/model/service/version/angular-toolbox-version.service.mjs +4 -4
- package/fesm2022/angular-toolbox.mjs +35 -3
- package/fesm2022/angular-toolbox.mjs.map +1 -1
- package/lib/model/business/index.d.ts +1 -0
- package/lib/model/business/navigator/battery-manager.d.ts +56 -0
- package/lib/model/business/navigator/connection-type.d.ts +11 -0
- package/lib/model/business/navigator/effective-connection-type.d.ts +11 -0
- package/lib/model/business/navigator/index.d.ts +4 -0
- package/lib/model/business/navigator/network-information.d.ts +53 -0
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Pascal ECHEMANN. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be found in
|
|
6
|
+
* the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The `BatteryManager` interface of the Battery Status API provides information about
|
|
10
|
+
* the system battery charge level. The `navigator.getBattery()` method returns a promise
|
|
11
|
+
* that resolves with a `BatteryManager` interface.
|
|
12
|
+
*/
|
|
13
|
+
export interface BatteryManager extends EventTarget {
|
|
14
|
+
/**
|
|
15
|
+
* A boolean value indicating whether the battery is currently being charged.
|
|
16
|
+
*/
|
|
17
|
+
readonly charging: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* A number representing the remaining time in seconds until the battery is fully charged,
|
|
20
|
+
* or 0 if the battery is already fully charged.
|
|
21
|
+
*/
|
|
22
|
+
readonly chargingTime: number;
|
|
23
|
+
/**
|
|
24
|
+
* A number representing the remaining time in seconds until the battery
|
|
25
|
+
* is completely discharged and the system suspends.
|
|
26
|
+
*/
|
|
27
|
+
readonly dischargingTime: number;
|
|
28
|
+
/**
|
|
29
|
+
* A number representing the system's battery charge level scaled to a value between 0.0 and 1.0.
|
|
30
|
+
*/
|
|
31
|
+
readonly level: number;
|
|
32
|
+
/**
|
|
33
|
+
* Fired when the battery charging state (the `charging` property) is updated.
|
|
34
|
+
*
|
|
35
|
+
* @param event A generic `Event`.
|
|
36
|
+
*/
|
|
37
|
+
onlevelchange(event: Event): void;
|
|
38
|
+
/**
|
|
39
|
+
* Fired when the battery charging time (the `chargingTime` property) is updated.
|
|
40
|
+
*
|
|
41
|
+
* @param event A generic `Event`.
|
|
42
|
+
*/
|
|
43
|
+
onchargingchange(event: Event): void;
|
|
44
|
+
/**
|
|
45
|
+
* Fired when the battery discharging time (the `dischargingTime` property) is updated.
|
|
46
|
+
*
|
|
47
|
+
* @param event A generic `Event`.
|
|
48
|
+
*/
|
|
49
|
+
chargingtimechange(event: Event): void;
|
|
50
|
+
/**
|
|
51
|
+
* Fired when the battery level (the `level` property) is updated.
|
|
52
|
+
*
|
|
53
|
+
* @param event A generic `Event`.
|
|
54
|
+
*/
|
|
55
|
+
dischargingtimechange(event: Event): void;
|
|
56
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Pascal ECHEMANN. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be found in
|
|
6
|
+
* the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The type of connection as defined by the `NetworkInformation.type` property.
|
|
10
|
+
*/
|
|
11
|
+
export type ConnectionType = 'bluetooth' | 'cellular' | 'ethernet' | 'mixed' | 'none' | 'other' | 'unknown' | 'wifi' | 'wimax';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Pascal ECHEMANN. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be found in
|
|
6
|
+
* the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The effective type of connection as defined by the `NetworkInformation.effectiveType` property.
|
|
10
|
+
*/
|
|
11
|
+
export type EffectiveConnectionType = '2g' | '3g' | '4g' | 'slow-2g';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Pascal ECHEMANN. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be found in
|
|
6
|
+
* the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
|
|
7
|
+
*/
|
|
8
|
+
import { ConnectionType } from "./connection-type";
|
|
9
|
+
import { EffectiveConnectionType } from "./effective-connection-type";
|
|
10
|
+
/**
|
|
11
|
+
* The `NetworkInformation` interface of the Network Information API provides
|
|
12
|
+
* information about the connection a device is using to communicate with the network
|
|
13
|
+
* and provides a means for scripts to be notified if the connection type changes.
|
|
14
|
+
* The `NetworkInformation` interface cannot be instantiated. It is instead accessed
|
|
15
|
+
* through the connection property of the `Navigator` interface or the `WorkerNavigator`
|
|
16
|
+
* interface.
|
|
17
|
+
*/
|
|
18
|
+
export interface NetworkInformation extends EventTarget {
|
|
19
|
+
/**
|
|
20
|
+
* Returns the effective bandwidth estimate in megabits per second,
|
|
21
|
+
* rounded to the nearest multiple of 25 kilobits per seconds.
|
|
22
|
+
*/
|
|
23
|
+
readonly downlink: number;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the maximum downlink speed, in megabits per second (Mbps),
|
|
26
|
+
* for the underlying connection technology.
|
|
27
|
+
*/
|
|
28
|
+
readonly downlinkMax: number;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the effective type of the connection meaning one of the `EffectiveConnectionType` enum.
|
|
31
|
+
* This value is determined using a combination of recently observed round-trip time and downlink values.
|
|
32
|
+
*/
|
|
33
|
+
readonly effectiveType: EffectiveConnectionType;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the type of connection a device is using to communicate with the network.
|
|
36
|
+
* It will be one of the `ConnectionType` enum.
|
|
37
|
+
*/
|
|
38
|
+
readonly type: ConnectionType;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the estimated effective round-trip time of the current connection,
|
|
41
|
+
* rounded to the nearest multiple of 25 milliseconds.
|
|
42
|
+
*/
|
|
43
|
+
readonly rtt: number;
|
|
44
|
+
/**
|
|
45
|
+
* Returns `true` whether the user has set a reduced data usage option on the user agent.
|
|
46
|
+
* `false` otherwise.
|
|
47
|
+
*/
|
|
48
|
+
readonly saveData: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The event that's fired when connection information changes.
|
|
51
|
+
*/
|
|
52
|
+
onchange: EventListener;
|
|
53
|
+
}
|