forked from FOSS/BangleApps
Update typescript types
parent
91eeea2ba0
commit
7e38b9b677
|
@ -161,6 +161,7 @@ type BangleOptions<Boolean = boolean> = {
|
||||||
wakeOnBTN3: Boolean;
|
wakeOnBTN3: Boolean;
|
||||||
wakeOnFaceUp: Boolean;
|
wakeOnFaceUp: Boolean;
|
||||||
wakeOnTouch: Boolean;
|
wakeOnTouch: Boolean;
|
||||||
|
wakeOnDoubleTap: Boolean;
|
||||||
wakeOnTwist: Boolean;
|
wakeOnTwist: Boolean;
|
||||||
twistThreshold: number;
|
twistThreshold: number;
|
||||||
twistMaxY: number;
|
twistMaxY: number;
|
||||||
|
@ -852,6 +853,25 @@ declare class NRF {
|
||||||
*/
|
*/
|
||||||
static on(event: "error", callback: (msg: any) => void): void;
|
static on(event: "error", callback: (msg: any) => void): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Added in 2v19) Called when a central device connects to Espruino, pairs, and sends a passkey that Espruino should display.
|
||||||
|
* For this to be used, you'll have to specify that your device has a display using `NRF.setSecurity({mitm:1, display:1});`
|
||||||
|
* For instance:
|
||||||
|
* ```
|
||||||
|
* NRF.setSecurity({mitm:1, display:1});
|
||||||
|
* NRF.on("passkey", key => print("Enter PIN: ",passkey));
|
||||||
|
* ```
|
||||||
|
* It is also possible to specify a static passkey with `NRF.setSecurity({passkey:"123456", mitm:1, display:1});`
|
||||||
|
* in which case no `passkey` event handler is needed (this method works on Espruino 2v02 and later)
|
||||||
|
* **Note:** A similar event, [`BluetoothDevice.on("passkey", ...)`](http://www.espruino.com/Reference#l_BluetoothDevice_passkey) is available
|
||||||
|
* for when Espruino is connecting *to* another device (central mode).
|
||||||
|
* @param {string} event - The event to listen to.
|
||||||
|
* @param {(passkey: any) => void} callback - A function that is executed when the event occurs. Its arguments are:
|
||||||
|
* * `passkey` A 6 character numeric String to be displayed
|
||||||
|
* @url http://www.espruino.com/Reference#l_NRF_passkey
|
||||||
|
*/
|
||||||
|
static on(event: "passkey", callback: (passkey: any) => void): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains updates on the security of the current Bluetooth link.
|
* Contains updates on the security of the current Bluetooth link.
|
||||||
* See Nordic's `ble_gap_evt_auth_status_t` structure for more information.
|
* See Nordic's `ble_gap_evt_auth_status_t` structure for more information.
|
||||||
|
@ -1014,6 +1034,36 @@ declare class NRF {
|
||||||
*/
|
*/
|
||||||
static setAddress(addr: any): void;
|
static setAddress(addr: any): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to resolve a **bonded** peer's address from a random private resolvable address. If the peer
|
||||||
|
* is not bonded, there will be no IRK and `undefined` will be returned.
|
||||||
|
* A bunch of devices, especially smartphones, implement address randomisation and periodically change
|
||||||
|
* their bluetooth address to prevent being tracked.
|
||||||
|
* If such a device uses a "random private resolvable address", that address is generated
|
||||||
|
* with the help of an identity resolving key (IRK) that is exchanged during bonding.
|
||||||
|
* If we know the IRK of a device, we can check if an address was potentially generated by that device.
|
||||||
|
* The following will check an address against the IRKs of all bonded devices,
|
||||||
|
* and return the actual address of a bonded device if the given address was likely generated using that device's IRK:
|
||||||
|
* ```
|
||||||
|
* NRF.on('connect',addr=> {
|
||||||
|
* // addr could be "aa:bb:cc:dd:ee:ff private-resolvable"
|
||||||
|
* if (addr.endsWith("private-resolvable")) {
|
||||||
|
* let resolved = NRF.resolveAddress(addr);
|
||||||
|
* // resolved is "aa:bb:cc:dd:ee:ff public"
|
||||||
|
* if (resolved) addr = resolved;
|
||||||
|
* }
|
||||||
|
* console.log("Device connected: ", addr);
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
* You can get the current connection's address using `NRF.getSecurityStatus().connected_addr`,
|
||||||
|
* so can for instance do `NRF.resolveAddress(NRF.getSecurityStatus().connected_addr)`.
|
||||||
|
*
|
||||||
|
* @param {any} options - The address that should be resolved.
|
||||||
|
* @returns {any} The resolved address, or `undefined` if it couldn't be resolved.
|
||||||
|
* @url http://www.espruino.com/Reference#l_NRF_resolveAddress
|
||||||
|
*/
|
||||||
|
static resolveAddress(options: any): any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the battery level in volts (the voltage that the NRF chip is running off
|
* Get the battery level in volts (the voltage that the NRF chip is running off
|
||||||
* of).
|
* of).
|
||||||
|
@ -1097,7 +1147,7 @@ declare class NRF {
|
||||||
* interval: 600 // Advertising interval in msec, between 20 and 10000 (default is 375ms)
|
* interval: 600 // Advertising interval in msec, between 20 and 10000 (default is 375ms)
|
||||||
* manufacturer: 0x0590 // IF sending manufacturer data, this is the manufacturer ID
|
* manufacturer: 0x0590 // IF sending manufacturer data, this is the manufacturer ID
|
||||||
* manufacturerData: [...] // IF sending manufacturer data, this is an array of data
|
* manufacturerData: [...] // IF sending manufacturer data, this is an array of data
|
||||||
* phy: "1mbps/2mbps/coded" // (NRF52840 only) use the long-range coded phy for transmission (1mbps default)
|
* phy: "1mbps/2mbps/coded" // (NRF52833/NRF52840 only) use the long-range coded phy for transmission (1mbps default)
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
* Setting `connectable` and `scannable` to false gives the lowest power
|
* Setting `connectable` and `scannable` to false gives the lowest power
|
||||||
|
@ -1830,9 +1880,9 @@ declare class NRF {
|
||||||
* * `active` - whether to perform active scanning (requesting 'scan response'
|
* * `active` - whether to perform active scanning (requesting 'scan response'
|
||||||
* packets from any devices that are found). e.g. `NRF.requestDevice({ active:true,
|
* packets from any devices that are found). e.g. `NRF.requestDevice({ active:true,
|
||||||
* filters: [ ... ] })`
|
* filters: [ ... ] })`
|
||||||
* * `phy` - (NRF52840 only) use the long-range coded phy (`"1mbps"` default, can
|
* * `phy` - (NRF52833/NRF52840 only) use the long-range coded phy (`"1mbps"` default, can
|
||||||
* be `"1mbps/2mbps/both/coded"`)
|
* be `"1mbps/2mbps/both/coded"`)
|
||||||
* * `extended` - (NRF52840 only) support receiving extended-length advertising
|
* * `extended` - (NRF52833/NRF52840 only) support receiving extended-length advertising
|
||||||
* packets (default=true if phy isn't `"1mbps"`)
|
* packets (default=true if phy isn't `"1mbps"`)
|
||||||
* **NOTE:** `timeout` and `active` are not part of the Web Bluetooth standard.
|
* **NOTE:** `timeout` and `active` are not part of the Web Bluetooth standard.
|
||||||
* The following filter types are implemented:
|
* The following filter types are implemented:
|
||||||
|
@ -1983,19 +2033,21 @@ declare class NRF {
|
||||||
* central *and* peripheral mode.
|
* central *and* peripheral mode.
|
||||||
* ```
|
* ```
|
||||||
* NRF.setSecurity({
|
* NRF.setSecurity({
|
||||||
* display : bool // default false, can this device display a passkey
|
* display : bool // default false, can this device display a passkey on a screen/etc?
|
||||||
* // - sent via the `BluetoothDevice.passkey` event
|
* // - sent via the `BluetoothDevice.passkey` event
|
||||||
* keyboard : bool // default false, can this device enter a passkey
|
* keyboard : bool // default false, can this device enter a passkey
|
||||||
* // - request sent via the `BluetoothDevice.passkeyRequest` event
|
* // - request sent via the `BluetoothDevice.passkeyRequest` event
|
||||||
|
* pair : bool // default true, allow other devices to pair with this device
|
||||||
* bond : bool // default true, Perform bonding
|
* bond : bool // default true, Perform bonding
|
||||||
|
* // This stores info from pairing in flash and allows reconnecting without having to pair each time
|
||||||
* mitm : bool // default false, Man In The Middle protection
|
* mitm : bool // default false, Man In The Middle protection
|
||||||
* lesc : bool // default false, LE Secure Connections
|
* lesc : bool // default false, LE Secure Connections
|
||||||
* passkey : // default "", or a 6 digit passkey to use
|
* passkey : // default "", or a 6 digit passkey to use (display must be true for this)
|
||||||
* oob : [0..15] // if specified, Out Of Band pairing is enabled and
|
* oob : [0..15] // if specified, Out Of Band pairing is enabled and
|
||||||
* // the 16 byte pairing code supplied here is used
|
* // the 16 byte pairing code supplied here is used
|
||||||
* encryptUart : bool // default false (unless oob or passkey specified)
|
* encryptUart : bool // default false (unless oob or passkey specified)
|
||||||
* // This sets the BLE UART service such that it
|
* // This sets the BLE UART service such that it
|
||||||
* // is encrypted and can only be used from a bonded connection
|
* // is encrypted and can only be used from a paired connection
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
* **NOTE:** Some combinations of arguments will cause an error. For example
|
* **NOTE:** Some combinations of arguments will cause an error. For example
|
||||||
|
@ -2006,6 +2058,12 @@ declare class NRF {
|
||||||
* ```
|
* ```
|
||||||
* NRF.setSecurity({passkey:"123456", mitm:1, display:1});
|
* NRF.setSecurity({passkey:"123456", mitm:1, display:1});
|
||||||
* ```
|
* ```
|
||||||
|
* Or to require pairing and to display a PIN that the connecting device
|
||||||
|
* provides, use:
|
||||||
|
* ```
|
||||||
|
* NRF.setSecurity({mitm:1, display:1});
|
||||||
|
* NRF.on("passkey", key => print("Enter PIN: ", key));
|
||||||
|
* ```
|
||||||
* However, while most devices will request a passkey for pairing at this point it
|
* However, while most devices will request a passkey for pairing at this point it
|
||||||
* is still possible for a device to connect without requiring one (e.g. using the
|
* is still possible for a device to connect without requiring one (e.g. using the
|
||||||
* 'NRF Connect' app).
|
* 'NRF Connect' app).
|
||||||
|
@ -2293,6 +2351,15 @@ declare class Trig {
|
||||||
static getErrorArray(): any;
|
static getErrorArray(): any;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url http://www.espruino.com/Reference#Dickens
|
||||||
|
*/
|
||||||
|
declare class Dickens {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3430,12 +3497,149 @@ declare class Puck {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class containing utility functions for the [Jolt.js Smart Bluetooth driver](http://www.espruino.com/Jolt.js)
|
||||||
|
* @url http://www.espruino.com/Reference#Jolt
|
||||||
|
*/
|
||||||
|
declare class Jolt {
|
||||||
|
/**
|
||||||
|
* `Q0` and `Q1` Qwiic connectors can have their power controlled by a 500mA FET connected to GND.
|
||||||
|
* The `sda` and `scl` pins on this port are also analog inputs - use `analogRead(Jolt.Q0.sda)`/etc
|
||||||
|
* To turn this connector on run `Jolt.Q0.setPower(1)`
|
||||||
|
* @returns {any} An object containing the pins for the Q0 connector on Jolt.js `{sda,scl,fet}`
|
||||||
|
* @url http://www.espruino.com/Reference#l_Jolt_Q0
|
||||||
|
*/
|
||||||
|
static Q0: Qwiic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `Q0` and `Q1` Qwiic connectors can have their power controlled by a 500mA FET connected to GND.
|
||||||
|
* The `sda` and `scl` pins on this port are also analog inputs - use `analogRead(Jolt.Q1.sda)`/etc
|
||||||
|
* To turn this connector on run `Jolt.Q1.setPower(1)`
|
||||||
|
* @returns {any} An object containing the pins for the Q1 connector on Jolt.js `{sda,scl,fet}`
|
||||||
|
* @url http://www.espruino.com/Reference#l_Jolt_Q1
|
||||||
|
*/
|
||||||
|
static Q1: Qwiic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `Q2` and `Q3` have all 4 pins connected to Jolt.js's GPIO (including those usually used for power).
|
||||||
|
* As such only around 8mA of power can be supplied to any connected device.
|
||||||
|
* To use this as a normal Qwiic connector, run `Jolt.Q2.setPower(1)`
|
||||||
|
* @returns {any} An object containing the pins for the Q2 connector on Jolt.js `{sda,scl,gnd,vcc}`
|
||||||
|
* @url http://www.espruino.com/Reference#l_Jolt_Q2
|
||||||
|
*/
|
||||||
|
static Q2: Qwiic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `Q2` and `Q3` have all 4 pins connected to Jolt.js's GPIO (including those usually used for power).
|
||||||
|
* As such only around 8mA of power can be supplied to any connected device.
|
||||||
|
* To use this as a normal Qwiic connector, run `Jolt.Q3.setPower(1)`
|
||||||
|
* @returns {any} An object containing the pins for the Q3 connector on Jolt.js `{sda,scl,gnd,vcc}`
|
||||||
|
* @url http://www.espruino.com/Reference#l_Jolt_Q3
|
||||||
|
*/
|
||||||
|
static Q3: Qwiic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the mode of the motor drivers. Jolt.js has two motor drivers,
|
||||||
|
* one (`0`) for outputs 0..3, and one (`1`) for outputs 4..7. They
|
||||||
|
* can be controlled independently.
|
||||||
|
* Mode can be:
|
||||||
|
* * `undefined` / `false` / `"off"` - the motor driver is off, all motor driver pins are open circuit
|
||||||
|
* * `true` / `"output"` - **[recommended]** driver is set to "Independent bridge" mode. All 4 outputs are enabled and are either
|
||||||
|
* * `"motor"` - driver is set to "4 pin interface" mode where pins are paired up (V0+V1, V2+V3, etc). If both
|
||||||
|
* in a pair are 0 the output is open circuit (motor coast), if both are 1 both otputs are 0 (motor brake), and
|
||||||
|
* if both are different, those values are on the output:
|
||||||
|
* `output` mode:
|
||||||
|
* | V0 | V1 | Out 0 | Out 1 |
|
||||||
|
* |----|----|-------|-------|
|
||||||
|
* | 0 | 0 | Low | Low |
|
||||||
|
* | 0 | 1 | Low | High |
|
||||||
|
* | 1 | 0 | High | Low |
|
||||||
|
* | 1 | 1 | High | High |
|
||||||
|
* `motor` mode
|
||||||
|
* | V0 | V1 | Out 0 | Out 1 |
|
||||||
|
* |----|----|-------|-------|
|
||||||
|
* | 0 | 0 | Open | Open |
|
||||||
|
* | 0 | 1 | Low | High |
|
||||||
|
* | 1 | 0 | High | Low |
|
||||||
|
* | 1 | 1 | Low | Low |
|
||||||
|
*
|
||||||
|
* @param {number} driver - The number of the motor driver (0 or 1)
|
||||||
|
* @param {any} mode - The mode of the motor driver (see below)
|
||||||
|
* @url http://www.espruino.com/Reference#l_Jolt_setDriverMode
|
||||||
|
*/
|
||||||
|
static setDriverMode(driver: number, mode: any): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run a self-test, and return true for a pass. This checks for shorts between
|
||||||
|
* pins, so your Jolt shouldn't have anything connected to it.
|
||||||
|
* **Note:** This self-test auto starts if you hold the button on your Jolt down
|
||||||
|
* while inserting the battery, leave it pressed for 3 seconds (while the green LED
|
||||||
|
* is lit) and release it soon after all LEDs turn on. 5 red blinks is a fail, 5
|
||||||
|
* green is a pass.
|
||||||
|
* If the self test fails, it'll set the Jolt.js Bluetooth advertising name to
|
||||||
|
* `Jolt.js !ERR` where ERR is a 3 letter error code.
|
||||||
|
* @returns {boolean} True if the self-test passed
|
||||||
|
* @url http://www.espruino.com/Reference#l_Jolt_selfTest
|
||||||
|
*/
|
||||||
|
static selfTest(): boolean;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class containing utility functions for the Qwiic connectors
|
||||||
|
* on the [Jolt.js Smart Bluetooth driver](http://www.espruino.com/Jolt.js).
|
||||||
|
* Each class (available from `Jolt.Q0`/`Jolt.Q1`/`Jolt.Q2`/`Jolt.Q3`)
|
||||||
|
* has `sda` and `scl` fields with the pins for SDA and SCL on them.
|
||||||
|
* On Jolt.js, the four Qwiic connectors can be individually powered:
|
||||||
|
* * Q0/Q1 - GND is switched with a 500mA FET. The `fet` field contains the pin that controls the FET
|
||||||
|
* * Q2/Q3 - all 4 pins are connected to GPIO. `gnd` and `vcc` fields contain the pins for GND and VCC
|
||||||
|
* To control the power, use `Qwiic.setPower`, for example: `Jolt.Q0.setPower(true)`
|
||||||
|
* @url http://www.espruino.com/Reference#Qwiic
|
||||||
|
*/
|
||||||
|
declare class Qwiic {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This turns power for the given Qwiic connector on or off. See `Qwiic` for more information.
|
||||||
|
*
|
||||||
|
* @param {boolean} isOn - Whether the Qwiic connector is to be on or not
|
||||||
|
* @returns {any} The same Qwiic object (for call chaining)
|
||||||
|
* @url http://www.espruino.com/Reference#l_Qwiic_setPower
|
||||||
|
*/
|
||||||
|
setPower(isOn: boolean): any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {any} An I2C object using this Qwiic connector, already set up
|
||||||
|
* @url http://www.espruino.com/Reference#l_Qwiic_i2c
|
||||||
|
*/
|
||||||
|
i2c: any;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class containing utility functions for the [Bangle.js Smart
|
* Class containing utility functions for the [Bangle.js Smart
|
||||||
* Watch](http://www.espruino.com/Bangle.js)
|
* Watch](http://www.espruino.com/Bangle.js)
|
||||||
* @url http://www.espruino.com/Reference#Bangle
|
* @url http://www.espruino.com/Reference#Bangle
|
||||||
*/
|
*/
|
||||||
declare class Bangle {
|
declare class Bangle {
|
||||||
|
/**
|
||||||
|
* @url http://www.espruino.com/Reference#l_Bangle_drawWidgets
|
||||||
|
*/
|
||||||
|
static drawWidgets(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url http://www.espruino.com/Reference#l_Bangle_setUI
|
||||||
|
*/
|
||||||
|
static setUI(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rotation of the LCD display (relative to its nominal orientation)
|
||||||
|
*
|
||||||
|
* @param {number} d - The number of degrees to the LCD display (0, 90, 180 or 270)
|
||||||
|
* @url http://www.espruino.com/Reference#l_Bangle_setLCDRotation
|
||||||
|
*/
|
||||||
|
static setLCDRotation(d: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accelerometer data available with `{x,y,z,diff,mag}` object as a parameter.
|
* Accelerometer data available with `{x,y,z,diff,mag}` object as a parameter.
|
||||||
* * `x` is X axis (left-right) in `g`
|
* * `x` is X axis (left-right) in `g`
|
||||||
|
@ -3589,6 +3793,17 @@ declare class Bangle {
|
||||||
*/
|
*/
|
||||||
static on(event: "HRM-raw", callback: (hrm: { raw: number, filt: number, bpm: number, confidence: number }) => void): void;
|
static on(event: "HRM-raw", callback: (hrm: { raw: number, filt: number, bpm: number, confidence: number }) => void): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when an environment sample heart rate sensor data is available (this is the amount of light received by the HRM sensor from the environment when its LED is off). On the newest VC31B based watches this is only 4 bit (0..15).
|
||||||
|
* To get it you need to turn the HRM on with `Bangle.setHRMPower(1)` and also set `Bangle.setOptions({hrmPushEnv:true})`.
|
||||||
|
* It is also possible to poke registers with `Bangle.hrmWr` to increase the poll rate if needed. See https://banglejs.com/apps/?id=flashcount for an example of this.
|
||||||
|
* @param {string} event - The event to listen to.
|
||||||
|
* @param {(env: any) => void} callback - A function that is executed when the event occurs. Its arguments are:
|
||||||
|
* * `env` An integer containing current environment reading (light level)
|
||||||
|
* @url http://www.espruino.com/Reference#l_Bangle_HRM-env
|
||||||
|
*/
|
||||||
|
static on(event: "HRM-env", callback: (env: any) => void): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When `Bangle.setBarometerPower(true)` is called, this event is fired containing
|
* When `Bangle.setBarometerPower(true)` is called, this event is fired containing
|
||||||
* barometer readings.
|
* barometer readings.
|
||||||
|
@ -3623,11 +3838,12 @@ declare class Bangle {
|
||||||
/**
|
/**
|
||||||
* Has the screen been locked? Also see `Bangle.isLocked()`
|
* Has the screen been locked? Also see `Bangle.isLocked()`
|
||||||
* @param {string} event - The event to listen to.
|
* @param {string} event - The event to listen to.
|
||||||
* @param {(on: boolean) => void} callback - A function that is executed when the event occurs. Its arguments are:
|
* @param {(on: boolean, reason: string) => void} callback - A function that is executed when the event occurs. Its arguments are:
|
||||||
* * `on` `true` if screen is locked, `false` if it is unlocked and touchscreen/buttons will work
|
* * `on` `true` if screen is locked, `false` if it is unlocked and touchscreen/buttons will work
|
||||||
|
* * `reason` (2v20 onwards) If known, the reason for locking/unlocking - 'button','js','tap','doubleTap','faceUp','twist','timeout'
|
||||||
* @url http://www.espruino.com/Reference#l_Bangle_lock
|
* @url http://www.espruino.com/Reference#l_Bangle_lock
|
||||||
*/
|
*/
|
||||||
static on(event: "lock", callback: (on: boolean) => void): void;
|
static on(event: "lock", callback: (on: boolean, reason: string) => void): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the watch is tapped, this event contains information on the way it was
|
* If the watch is tapped, this event contains information on the way it was
|
||||||
|
@ -3883,12 +4099,13 @@ declare class Bangle {
|
||||||
* },38,38);
|
* },38,38);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param {any} img - An image
|
* @param {any} img - An image, or undefined to clear
|
||||||
* @param {number} x - The X offset the graphics instance should be overlaid on the screen with
|
* @param {number} x - The X offset the graphics instance should be overlaid on the screen with
|
||||||
* @param {number} y - The Y offset the graphics instance should be overlaid on the screen with
|
* @param {number} y - The Y offset the graphics instance should be overlaid on the screen with
|
||||||
* @url http://www.espruino.com/Reference#l_Bangle_setLCDOverlay
|
* @url http://www.espruino.com/Reference#l_Bangle_setLCDOverlay
|
||||||
*/
|
*/
|
||||||
static setLCDOverlay(img: any, x: number, y: number): void;
|
static setLCDOverlay(img: any, x: number, y: number): void;
|
||||||
|
static setLCDOverlay(): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function can be used to turn Bangle.js's LCD power saving on or off.
|
* This function can be used to turn Bangle.js's LCD power saving on or off.
|
||||||
|
@ -3928,8 +4145,11 @@ declare class Bangle {
|
||||||
* default = `true`
|
* default = `true`
|
||||||
* * `wakeOnFaceUp` should the LCD turn on when the watch is turned face up?
|
* * `wakeOnFaceUp` should the LCD turn on when the watch is turned face up?
|
||||||
* default = `false`
|
* default = `false`
|
||||||
* * `wakeOnTouch` should the LCD turn on when the touchscreen is pressed? default
|
* * `wakeOnTouch` should the LCD turn on when the touchscreen is pressed? On Bangle.js 1 this
|
||||||
* = `false`
|
* is a physical press on the touchscreen, on Bangle.js 2 we have to use the accelerometer as
|
||||||
|
* the touchscreen cannot be left powered without running the battery down. default = `false`
|
||||||
|
* * `wakeOnDoubleTap` (2v20 onwards) should the LCD turn on when the watch is double-tapped on the screen?
|
||||||
|
* This uses the accelerometer, not the touchscreen itself. default = `false`
|
||||||
* * `wakeOnTwist` should the LCD turn on when the watch is twisted? default =
|
* * `wakeOnTwist` should the LCD turn on when the watch is twisted? default =
|
||||||
* `true`
|
* `true`
|
||||||
* * `twistThreshold` How much acceleration to register a twist of the watch strap?
|
* * `twistThreshold` How much acceleration to register a twist of the watch strap?
|
||||||
|
@ -3965,10 +4185,14 @@ declare class Bangle {
|
||||||
* heart rate monitor. On Bangle.js 2 only 10,20,40,80,160,200 ms are supported,
|
* heart rate monitor. On Bangle.js 2 only 10,20,40,80,160,200 ms are supported,
|
||||||
* and polling rate may not be exact. The algorithm's filtering is tuned for
|
* and polling rate may not be exact. The algorithm's filtering is tuned for
|
||||||
* 20-40ms poll intervals, so higher/lower intervals may effect the reliability
|
* 20-40ms poll intervals, so higher/lower intervals may effect the reliability
|
||||||
* of the BPM reading.
|
* of the BPM reading. You must call this *before* `Bangle.setHRMPower` - calling
|
||||||
|
* when the HRM is already on will not affect the poll rate.
|
||||||
* * `hrmSportMode` - on the newest Bangle.js 2 builds with with the proprietary
|
* * `hrmSportMode` - on the newest Bangle.js 2 builds with with the proprietary
|
||||||
* heart rate algorithm, this is the sport mode passed to the algorithm. See `libs/misc/vc31_binary/algo.h`
|
* heart rate algorithm, this is the sport mode passed to the algorithm. See `libs/misc/vc31_binary/algo.h`
|
||||||
* for more info. -1 = auto, 0 = normal (default), 1 = running, 2 = ...
|
* for more info. -1 = auto, 0 = normal (default), 1 = running, 2 = ...
|
||||||
|
* * `hrmGreenAdjust` - (Bangle.js 2, 2v19+) if false (default is true) the green LED intensity won't be adjusted to get the HRM sensor 'exposure' correct. This is reset when the HRM is initialised with `Bangle.setHRMPower`.
|
||||||
|
* * `hrmWearDetect` - (Bangle.js 2, 2v19+) if false (default is true) HRM readings won't be turned off if the watch isn't on your arm (based on HRM proximity sensor). This is reset when the HRM is initialised with `Bangle.setHRMPower`.
|
||||||
|
* * `hrmPushEnv` - (Bangle.js 2, 2v19+) if true (default is false) HRM environment readings will be produced as `Bangle.on(`HRM-env`, ...)` events. This is reset when the HRM is initialised with `Bangle.setHRMPower`.
|
||||||
* * `seaLevelPressure` (Bangle.js 2) Normally 1013.25 millibars - this is used for
|
* * `seaLevelPressure` (Bangle.js 2) Normally 1013.25 millibars - this is used for
|
||||||
* calculating altitude with the pressure sensor
|
* calculating altitude with the pressure sensor
|
||||||
* Where accelerations are used they are in internal units, where `8192 = 1g`
|
* Where accelerations are used they are in internal units, where `8192 = 1g`
|
||||||
|
@ -4309,6 +4533,8 @@ declare class Bangle {
|
||||||
* will return almost immediately with the reading. If the Barometer is off,
|
* will return almost immediately with the reading. If the Barometer is off,
|
||||||
* conversions take between 500-750ms.
|
* conversions take between 500-750ms.
|
||||||
* Altitude assumes a sea-level pressure of 1013.25 hPa
|
* Altitude assumes a sea-level pressure of 1013.25 hPa
|
||||||
|
* If there's no pressure device (for example, the emulator),
|
||||||
|
* this returns undefined, rather than a promise.
|
||||||
* ```
|
* ```
|
||||||
* Bangle.getPressure().then(d=>{
|
* Bangle.getPressure().then(d=>{
|
||||||
* console.log(d);
|
* console.log(d);
|
||||||
|
@ -4318,7 +4544,7 @@ declare class Bangle {
|
||||||
* @returns {any} A promise that will be resolved with `{temperature, pressure, altitude}`
|
* @returns {any} A promise that will be resolved with `{temperature, pressure, altitude}`
|
||||||
* @url http://www.espruino.com/Reference#l_Bangle_getPressure
|
* @url http://www.espruino.com/Reference#l_Bangle_getPressure
|
||||||
*/
|
*/
|
||||||
static getPressure(): PressureData;
|
static getPressure(): Promise<PressureData> | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a Spherical [Web Mercator
|
* Perform a Spherical [Web Mercator
|
||||||
|
@ -4412,11 +4638,27 @@ declare class Bangle {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a 'recovery' menu that allows you to perform certain tasks on your Bangle.
|
* Show a 'recovery' menu that allows you to perform certain tasks on your Bangle.
|
||||||
* You can also enter this menu by restarting while holding down the `BTN1`
|
* You can also enter this menu by restarting your Bangle while holding down the button.
|
||||||
* @url http://www.espruino.com/Reference#l_Bangle_showRecoveryMenu
|
* @url http://www.espruino.com/Reference#l_Bangle_showRecoveryMenu
|
||||||
*/
|
*/
|
||||||
static showRecoveryMenu(): void;
|
static showRecoveryMenu(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url http://www.espruino.com/Reference#l_Bangle_showRecoveryMenu
|
||||||
|
*/
|
||||||
|
static showRecoveryMenu(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (2v20 and later) Show a test screen that lights green when each sensor on the Bangle
|
||||||
|
* works and reports within range.
|
||||||
|
* Swipe on the screen when all items are green and the Bangle will turn bluetooth off
|
||||||
|
* and display a `TEST PASS` screen for 60 minutes, after which it will turn off.
|
||||||
|
* You can enter this menu by restarting your Bangle while holding down the button,
|
||||||
|
* then choosing `Test` from the recovery menu.
|
||||||
|
* @url http://www.espruino.com/Reference#l_Bangle_showTestScreen
|
||||||
|
*/
|
||||||
|
static showTestScreen(): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This behaves the same as the global `load()` function, but if fast
|
* This behaves the same as the global `load()` function, but if fast
|
||||||
* loading is possible (`Bangle.setUI` was called with a `remove` handler)
|
* loading is possible (`Bangle.setUI` was called with a `remove` handler)
|
||||||
|
@ -4519,9 +4761,11 @@ declare class Bangle {
|
||||||
* Erase all storage and reload it with the default contents.
|
* Erase all storage and reload it with the default contents.
|
||||||
* This is only available on Bangle.js 2.0. On Bangle.js 1.0 you need to use
|
* This is only available on Bangle.js 2.0. On Bangle.js 1.0 you need to use
|
||||||
* `Install Default Apps` under the `More...` tab of http://banglejs.com/apps
|
* `Install Default Apps` under the `More...` tab of http://banglejs.com/apps
|
||||||
|
*
|
||||||
|
* @param {boolean} noReboot - Do not reboot the watch when done (default false, so will reboot)
|
||||||
* @url http://www.espruino.com/Reference#l_Bangle_factoryReset
|
* @url http://www.espruino.com/Reference#l_Bangle_factoryReset
|
||||||
*/
|
*/
|
||||||
static factoryReset(): void;
|
static factoryReset(noReboot: boolean): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the rectangle on the screen that is currently reserved for the app.
|
* Returns the rectangle on the screen that is currently reserved for the app.
|
||||||
|
@ -4636,7 +4880,7 @@ declare class BluetoothDevice {
|
||||||
/**
|
/**
|
||||||
* Called when the device pairs, displays a passkey, and wants Espruino to tell it
|
* Called when the device pairs, displays a passkey, and wants Espruino to tell it
|
||||||
* what the passkey was.
|
* what the passkey was.
|
||||||
* Respond with `BluetoothDevice.sendPasskey()` with a 6 character string
|
* Respond with `BluetoothDevice.sendPasskey("123456")` with a 6 character string
|
||||||
* containing only `0..9`.
|
* containing only `0..9`.
|
||||||
* For this to be used, you'll have to specify that there's a keyboard using
|
* For this to be used, you'll have to specify that there's a keyboard using
|
||||||
* `NRF.setSecurity`
|
* `NRF.setSecurity`
|
||||||
|
@ -5111,6 +5355,40 @@ declare class Graphics<IsBuffer extends boolean = boolean> {
|
||||||
*/
|
*/
|
||||||
static createImage(str: string): ImageObject;
|
static createImage(str: string): ImageObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a filled arc between two angles
|
||||||
|
*
|
||||||
|
* @param {number} a1 - Angle 1 (radians)
|
||||||
|
* @param {number} a2 - Angle 2 (radians)
|
||||||
|
* @param {number} r - Radius
|
||||||
|
* @returns {any} The instance of Graphics this was called on, to allow call chaining
|
||||||
|
* @url http://www.espruino.com/Reference#l_Graphics_fillArc
|
||||||
|
*/
|
||||||
|
fillArc(a1: number, a2: number, r: number): Graphics;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw rectangle between angles a-ar and a+ar, and radius r1/r2
|
||||||
|
*
|
||||||
|
* @param {number} a - Angle (radians)
|
||||||
|
* @param {number} ar - Angle either side (radians)
|
||||||
|
* @param {number} r1 - Radius
|
||||||
|
* @param {number} r2 - Radius
|
||||||
|
* @returns {any} The instance of Graphics this was called on, to allow call chaining
|
||||||
|
* @url http://www.espruino.com/Reference#l_Graphics_fillSeg
|
||||||
|
*/
|
||||||
|
fillSeg(a: number, ar: number, r1: number, r2: number): Graphics;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw A line between angles a-ar and a+ar at radius r
|
||||||
|
*
|
||||||
|
* @param {number} a - Angle (radians)
|
||||||
|
* @param {number} ar - Angle either side (radians)
|
||||||
|
* @param {number} r - Radius
|
||||||
|
* @returns {any} The instance of Graphics this was called on, to allow call chaining
|
||||||
|
* @url http://www.espruino.com/Reference#l_Graphics_drawSeg
|
||||||
|
*/
|
||||||
|
drawSeg(a: number, ar: number, r: number): Graphics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current font
|
* Set the current font
|
||||||
*
|
*
|
||||||
|
@ -5267,6 +5545,18 @@ declare class Graphics<IsBuffer extends boolean = boolean> {
|
||||||
*/
|
*/
|
||||||
fillCircle(x: number, y: number, rad: number): Graphics;
|
fillCircle(x: number, y: number, rad: number): Graphics;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a filled annulus in the Foreground Color
|
||||||
|
*
|
||||||
|
* @param {number} x - The X axis
|
||||||
|
* @param {number} y - The Y axis
|
||||||
|
* @param {number} r1 - The annulus inner radius
|
||||||
|
* @param {number} r2 - The annulus outer radius
|
||||||
|
* @returns {any} The instance of Graphics this was called on, to allow call chaining
|
||||||
|
* @url http://www.espruino.com/Reference#l_Graphics_fillAnnulus
|
||||||
|
*/
|
||||||
|
fillAnnulus(x: number, y: number, r1: number, r2: number): Graphics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw an unfilled circle 1px wide in the Foreground Color
|
* Draw an unfilled circle 1px wide in the Foreground Color
|
||||||
*
|
*
|
||||||
|
@ -5558,13 +5848,22 @@ declare class Graphics<IsBuffer extends boolean = boolean> {
|
||||||
stringWidth(str: string): number;
|
stringWidth(str: string): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the width and height in pixels of a string of text in the current font
|
* Return the width and height in pixels of a string of text in the current font. The object returned contains:
|
||||||
|
* ```JS
|
||||||
|
* {
|
||||||
|
* width, // Width of the string in pixels
|
||||||
|
* height, // Height of the string in pixels
|
||||||
|
* unrenderableChars, // If true, the string contains characters that the current font isn't able to render.
|
||||||
|
* imageCount, // How many inline images are in this string?
|
||||||
|
* maxImageHeight, // If there are images, what is the maximum height of all images?
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
* @param {any} str - The string
|
* @param {any} str - The string
|
||||||
* @returns {any} An object containing `{width,height}` of the string
|
* @returns {any} An object containing `{width,height,etc}` for the string - see below
|
||||||
* @url http://www.espruino.com/Reference#l_Graphics_stringMetrics
|
* @url http://www.espruino.com/Reference#l_Graphics_stringMetrics
|
||||||
*/
|
*/
|
||||||
stringMetrics(str: string): { width: number, height: number };
|
stringMetrics(str: string): { width: number, height: number, unrenderableChars: boolean, imageCount : number, maxImageHeight : number };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrap a string to the given pixel width using the current font, and return the
|
* Wrap a string to the given pixel width using the current font, and return the
|
||||||
|
@ -5625,6 +5924,22 @@ declare class Graphics<IsBuffer extends boolean = boolean> {
|
||||||
*/
|
*/
|
||||||
getVectorFontPolys(str: any, options?: any): any[];
|
getVectorFontPolys(str: any, options?: any): any[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a string of text as a fixed-width line font
|
||||||
|
* `options` contains:
|
||||||
|
* * `size`: font size in pixels (char width is half font size) - default 16
|
||||||
|
* * `rotate`: Initial rotation in radians - default 0
|
||||||
|
* * `twist`: Subsequent rotation per character in radians - default 0
|
||||||
|
*
|
||||||
|
* @param {any} str - The string
|
||||||
|
* @param {number} x - The X position of the start of the text string
|
||||||
|
* @param {number} y - The Y position of the middle of the text string
|
||||||
|
* @param {any} options - Options for drawing this font (see below)
|
||||||
|
* @returns {any} The instance of Graphics this was called on, to allow call chaining
|
||||||
|
* @url http://www.espruino.com/Reference#l_Graphics_drawLineString
|
||||||
|
*/
|
||||||
|
drawLineString(str: any, x: number, y: number, options: any): Graphics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw a line between x1,y1 and x2,y2 in the current foreground color
|
* Draw a line between x1,y1 and x2,y2 in the current foreground color
|
||||||
*
|
*
|
||||||
|
@ -5778,6 +6093,8 @@ declare class Graphics<IsBuffer extends boolean = boolean> {
|
||||||
* disabled on devices without much flash memory available. If a Graphics object
|
* disabled on devices without much flash memory available. If a Graphics object
|
||||||
* is supplied, it can also contain transparent/palette fields as if it were
|
* is supplied, it can also contain transparent/palette fields as if it were
|
||||||
* an image.
|
* an image.
|
||||||
|
* See https://www.espruino.com/Graphics#images-bitmaps for more information about
|
||||||
|
* image formats.
|
||||||
* Draw an image at the specified position.
|
* Draw an image at the specified position.
|
||||||
* * If the image is 1 bit, the graphics foreground/background colours will be
|
* * If the image is 1 bit, the graphics foreground/background colours will be
|
||||||
* used.
|
* used.
|
||||||
|
@ -5796,6 +6113,7 @@ declare class Graphics<IsBuffer extends boolean = boolean> {
|
||||||
* scale : float, // the amount to scale the image up (default 1)
|
* scale : float, // the amount to scale the image up (default 1)
|
||||||
* frame : int // if specified and the image has frames of data
|
* frame : int // if specified and the image has frames of data
|
||||||
* // after the initial frame, draw one of those frames from the image
|
* // after the initial frame, draw one of those frames from the image
|
||||||
|
* filter : bool // (2v19+) when set, if scale<0.75 perform 2x2 supersampling to smoothly downscale the image
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
* For example:
|
* For example:
|
||||||
|
@ -5945,6 +6263,13 @@ declare class Graphics<IsBuffer extends boolean = boolean> {
|
||||||
*/
|
*/
|
||||||
dump(): void;
|
dump(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {any} filename - If supplied, a file to save, otherwise 'screenshot.img'
|
||||||
|
* @url http://www.espruino.com/Reference#l_Graphics_saveScreenshot
|
||||||
|
*/
|
||||||
|
saveScreenshot(filename: any): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the square area under a Bezier curve.
|
* Calculate the square area under a Bezier curve.
|
||||||
* x0,y0: start point x1,y1: control point y2,y2: end point
|
* x0,y0: start point x1,y1: control point y2,y2: end point
|
||||||
|
@ -6349,6 +6674,38 @@ interface consoleConstructor {
|
||||||
* @url http://www.espruino.com/Reference#l_console_log
|
* @url http://www.espruino.com/Reference#l_console_log
|
||||||
*/
|
*/
|
||||||
log(...text: any[]): void;
|
log(...text: any[]): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implemented in Espruino as an alias of `console.log`
|
||||||
|
*
|
||||||
|
* @param {any} text - One or more arguments to print
|
||||||
|
* @url http://www.espruino.com/Reference#l_console_debug
|
||||||
|
*/
|
||||||
|
debug(...text: any[]): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implemented in Espruino as an alias of `console.log`
|
||||||
|
*
|
||||||
|
* @param {any} text - One or more arguments to print
|
||||||
|
* @url http://www.espruino.com/Reference#l_console_info
|
||||||
|
*/
|
||||||
|
info(...text: any[]): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implemented in Espruino as an alias of `console.log`
|
||||||
|
*
|
||||||
|
* @param {any} text - One or more arguments to print
|
||||||
|
* @url http://www.espruino.com/Reference#l_console_warn
|
||||||
|
*/
|
||||||
|
warn(...text: any[]): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implemented in Espruino as an alias of `console.log`
|
||||||
|
*
|
||||||
|
* @param {any} text - One or more arguments to print
|
||||||
|
* @url http://www.espruino.com/Reference#l_console_error
|
||||||
|
*/
|
||||||
|
error(...text: any[]): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface console {
|
interface console {
|
||||||
|
@ -6939,7 +7296,7 @@ interface Float64ArrayConstructor {
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
* @param {any} arr - The array or typed array to base this off, or an integer which is the array length
|
* @param {any} arr - The array or typed array to base this off, or an integer which is the array length
|
||||||
* @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an ArrayBuffer)
|
* @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an ArrayBuffer). Maximum 65535.
|
||||||
* @param {number} length - The length (ONLY IF the first argument was an ArrayBuffer)
|
* @param {number} length - The length (ONLY IF the first argument was an ArrayBuffer)
|
||||||
* @returns {any} A typed array
|
* @returns {any} A typed array
|
||||||
* @url http://www.espruino.com/Reference#l_Float64Array_Float64Array
|
* @url http://www.espruino.com/Reference#l_Float64Array_Float64Array
|
||||||
|
@ -6956,7 +7313,9 @@ declare const Float64Array: Float64ArrayConstructor
|
||||||
interface DateConstructor {
|
interface DateConstructor {
|
||||||
/**
|
/**
|
||||||
* Get the number of milliseconds elapsed since 1970 (or on embedded platforms,
|
* Get the number of milliseconds elapsed since 1970 (or on embedded platforms,
|
||||||
* since startup)
|
* since startup).
|
||||||
|
* **Note:** Desktop JS engines return an integer value for `Date.now()`, however Espruino
|
||||||
|
* returns a floating point value, accurate to fractions of a millisecond.
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
* @url http://www.espruino.com/Reference#l_Date_now
|
* @url http://www.espruino.com/Reference#l_Date_now
|
||||||
*/
|
*/
|
||||||
|
@ -7598,6 +7957,21 @@ declare class E {
|
||||||
*/
|
*/
|
||||||
static showAlert(message?: string, options?: string): Promise<void>;
|
static showAlert(message?: string, options?: string): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url http://www.espruino.com/Reference#l_E_showMenu
|
||||||
|
*/
|
||||||
|
static showMenu(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url http://www.espruino.com/Reference#l_E_showPrompt
|
||||||
|
*/
|
||||||
|
static showPrompt(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url http://www.espruino.com/Reference#l_E_showMessage
|
||||||
|
*/
|
||||||
|
static showMessage(): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup the filesystem so that subsequent calls to `E.openFile` and
|
* Setup the filesystem so that subsequent calls to `E.openFile` and
|
||||||
* `require('fs').*` will use an SD card on the supplied SPI device and pin.
|
* `require('fs').*` will use an SD card on the supplied SPI device and pin.
|
||||||
|
@ -8211,8 +8585,31 @@ declare class E {
|
||||||
static setFlags(flags: { [key in Flag]?: boolean }): void
|
static setFlags(flags: { [key in Flag]?: boolean }): void
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Pipe one stream to another.
|
||||||
|
* This can be given any object with a `read` method as a source, and any object with a `.write(data)` method as a destination.
|
||||||
|
* Data will be piped from `source` to `destination` in the idle loop until `source.read(...)` returns `undefined`.
|
||||||
|
* For instance:
|
||||||
|
* ```
|
||||||
|
* // Print a really big string to the console, 1 character at a time and write 'Finished!' at the end
|
||||||
|
* E.pipe("This is a really big String",
|
||||||
|
* {write: print},
|
||||||
|
* {chunkSize:1, complete:()=>print("Finished!")});
|
||||||
|
* // Pipe the numbers 1 to 100 to a StorageFile in Storage
|
||||||
|
* E.pipe({ n:0, read : function() { if (this.n<100) return (this.n++)+"\n"; }},
|
||||||
|
* require("Storage").open("testfile","w"));
|
||||||
|
* // Pipe a StorageFile straight to the Bluetooth UART
|
||||||
|
* E.pipe(require("Storage").open("testfile","r"), Bluetooth);
|
||||||
|
* // Pipe a normal file in Storage (not StorageFile) straight to the Bluetooth UART
|
||||||
|
* E.pipe(require("Storage").read("blob.txt"), Bluetooth);
|
||||||
|
* // Pipe a normal file in Storage as a response to an HTTP request
|
||||||
|
* function onPageRequest(req, res) {
|
||||||
|
* res.writeHead(200, {'Content-Type': 'text/plain'});
|
||||||
|
* E.pipe(require("Storage").read("webpage.txt"), res);
|
||||||
|
* }
|
||||||
|
* require("http").createServer(onPageRequest).listen(80);
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
* @param {any} source - The source file/stream that will send content.
|
* @param {any} source - The source file/stream that will send content. As of 2v19 this can also be a `String`
|
||||||
* @param {any} destination - The destination file/stream that will receive content from the source.
|
* @param {any} destination - The destination file/stream that will receive content from the source.
|
||||||
* @param {any} [options]
|
* @param {any} [options]
|
||||||
* [optional] An object `{ chunkSize : int=64, end : bool=true, complete : function }`
|
* [optional] An object `{ chunkSize : int=64, end : bool=true, complete : function }`
|
||||||
|
@ -8719,10 +9116,10 @@ declare class E {
|
||||||
/**
|
/**
|
||||||
* Set the time zone to be used with `Date` objects.
|
* Set the time zone to be used with `Date` objects.
|
||||||
* For example `E.setTimeZone(1)` will be GMT+0100
|
* For example `E.setTimeZone(1)` will be GMT+0100
|
||||||
* Note that `E.setTimeZone()` will have no effect when daylight savings time rules
|
|
||||||
* have been set with `E.setDST()`. The timezone value will be stored, but never
|
|
||||||
* used so long as DST settings are in effect.
|
|
||||||
* Time can be set with `setTime`.
|
* Time can be set with `setTime`.
|
||||||
|
* **Note:** If daylight savings time rules have been set with `E.setDST()`,
|
||||||
|
* calling `E.setTimeZone()` will remove them and move back to using a static
|
||||||
|
* timezone that doesn't change based on the time of year.
|
||||||
*
|
*
|
||||||
* @param {number} zone - The time zone in hours
|
* @param {number} zone - The time zone in hours
|
||||||
* @url http://www.espruino.com/Reference#l_E_setTimeZone
|
* @url http://www.espruino.com/Reference#l_E_setTimeZone
|
||||||
|
@ -8767,10 +9164,20 @@ declare class E {
|
||||||
* winter (EET) and 3 hours in summer (EEST). DST starts at 03:00 EET on the last
|
* winter (EET) and 3 hours in summer (EEST). DST starts at 03:00 EET on the last
|
||||||
* Sunday in March, and ends at 04:00 EEST on the last Sunday in October. So
|
* Sunday in March, and ends at 04:00 EEST on the last Sunday in October. So
|
||||||
* someone in Ukraine might call `E.setDST(60,120,4,0,2,0,180,4,0,9,0,240);`
|
* someone in Ukraine might call `E.setDST(60,120,4,0,2,0,180,4,0,9,0,240);`
|
||||||
* Note that when DST parameters are set (i.e. when `dstOffset` is not zero),
|
* Examples:
|
||||||
* `E.setTimeZone()` has no effect.
|
* ```
|
||||||
|
* // United Kingdom
|
||||||
|
* E.setDST(60,0,4,0,2,0,60,4,0,9,0,120);
|
||||||
|
* // California, USA
|
||||||
|
* E.setDST(60,-480,1,0,2,0,120,0,0,10,0,120);
|
||||||
|
* // Or adjust -480 (-8 hours) for other US states
|
||||||
|
* // Ukraine
|
||||||
|
* E.setDST(60,120,4,0,2,0,180,4,0,9,0,240);
|
||||||
|
* ```
|
||||||
|
* **Note:** This is not compatible with `E.setTimeZone()`. Calling `E.setTimeZone()`
|
||||||
|
* after this will disable DST.
|
||||||
*
|
*
|
||||||
* @param {any} params - An array containing the settings for DST
|
* @param {any} params - An array containing the settings for DST, or `undefined` to disable
|
||||||
* @url http://www.espruino.com/Reference#l_E_setDST
|
* @url http://www.espruino.com/Reference#l_E_setDST
|
||||||
*/
|
*/
|
||||||
static setDST(dstOffset: number, timezone: number, startDowNumber: number, startDow: number, startMonth: number, startDayOffset: number, startTimeOfDay: number, endDowNumber: number, endDow: number, endMonth: number, endDayOffset: number, endTimeOfDay: number): void
|
static setDST(dstOffset: number, timezone: number, startDowNumber: number, startDow: number, startMonth: number, startDayOffset: number, startTimeOfDay: number, endDowNumber: number, endDow: number, endMonth: number, endDayOffset: number, endTimeOfDay: number): void
|
||||||
|
@ -9881,7 +10288,7 @@ declare class I2C {
|
||||||
/**
|
/**
|
||||||
* Request bytes from the given slave device, and return them as a Uint8Array
|
* Request bytes from the given slave device, and return them as a Uint8Array
|
||||||
* (packed array of bytes). This is like using Arduino Wire's requestFrom,
|
* (packed array of bytes). This is like using Arduino Wire's requestFrom,
|
||||||
* available and read functions. Sends a STOP
|
* available and read functions. Sends a STOP unless `{address:X, stop:false}` is used.
|
||||||
*
|
*
|
||||||
* @param {any} address - The 7 bit address of the device to request bytes from, or an object of the form `{address:12, stop:false}` to send this data without a STOP signal.
|
* @param {any} address - The 7 bit address of the device to request bytes from, or an object of the form `{address:12, stop:false}` to send this data without a STOP signal.
|
||||||
* @param {number} quantity - The number of bytes to request
|
* @param {number} quantity - The number of bytes to request
|
||||||
|
@ -9889,6 +10296,25 @@ declare class I2C {
|
||||||
* @url http://www.espruino.com/Reference#l_I2C_readFrom
|
* @url http://www.espruino.com/Reference#l_I2C_readFrom
|
||||||
*/
|
*/
|
||||||
readFrom(address: any, quantity: number): Uint8Array;
|
readFrom(address: any, quantity: number): Uint8Array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request bytes from a register on the given I2C slave device, and return them as a Uint8Array
|
||||||
|
* (packed array of bytes).
|
||||||
|
* This is the same as calling `I2C.writeTo` and `I2C.readFrom`:
|
||||||
|
* ```
|
||||||
|
* I2C.readReg = function(address, reg, quantity) {
|
||||||
|
* this.writeTo({address:address, stop:false}, reg);
|
||||||
|
* return this.readFrom(address, quantity);
|
||||||
|
* };
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {number} address - The 7 bit address of the device to request bytes from
|
||||||
|
* @param {number} reg - The register on the device to read bytes from
|
||||||
|
* @param {number} quantity - The number of bytes to request
|
||||||
|
* @returns {any} The data that was returned - as a Uint8Array
|
||||||
|
* @url http://www.espruino.com/Reference#l_I2C_readReg
|
||||||
|
*/
|
||||||
|
readReg(address: number, reg: number, quantity: number): Uint8Array;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PromiseConstructor {
|
interface PromiseConstructor {
|
||||||
|
@ -10040,7 +10466,9 @@ declare class StorageFile {
|
||||||
write(data: string): void;
|
write(data: string): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erase this file
|
* Erase this `StorageFile` - after being called this file can no longer be written to.
|
||||||
|
* **Note:** You shouldn't call `require("Storage").erase(...)` on a `StorageFile`, but should
|
||||||
|
* instead open the StorageFile and call `.erase` on the returned file: `require("Storage").open(..., "r").erase()`
|
||||||
* @url http://www.espruino.com/Reference#l_StorageFile_erase
|
* @url http://www.espruino.com/Reference#l_StorageFile_erase
|
||||||
*/
|
*/
|
||||||
erase(): void;
|
erase(): void;
|
||||||
|
@ -10442,13 +10870,12 @@ interface String {
|
||||||
/**
|
/**
|
||||||
* Return the integer value of a single character at the given position in the
|
* Return the integer value of a single character at the given position in the
|
||||||
* String.
|
* String.
|
||||||
* Note that this returns 0 not 'NaN' for out of bounds characters
|
|
||||||
*
|
*
|
||||||
* @param {number} pos - The character number in the string. Negative values return characters from end of string (-1 = last char)
|
* @param {number} pos - The character number in the string. Negative values return characters from end of string (-1 = last char)
|
||||||
* @returns {number} The integer value of a character in the string
|
* @returns {any} The integer value of a character in the string, or `NaN` if out of bounds
|
||||||
* @url http://www.espruino.com/Reference#l_String_charCodeAt
|
* @url http://www.espruino.com/Reference#l_String_charCodeAt
|
||||||
*/
|
*/
|
||||||
charCodeAt(pos: number): number;
|
charCodeAt(pos: number): any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the index of substring in this string, or -1 if not found
|
* Return the index of substring in this string, or -1 if not found
|
||||||
|
@ -10563,6 +10990,12 @@ interface String {
|
||||||
*/
|
*/
|
||||||
toUpperCase(): any;
|
toUpperCase(): any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {any} This string with the accents/diacritics (such as é, ü) removed from characters in the ISO 8859-1 set
|
||||||
|
* @url http://www.espruino.com/Reference#l_String_removeAccents
|
||||||
|
*/
|
||||||
|
removeAccents(): any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a new string with any whitespace (tabs, space, form feed, newline,
|
* Return a new string with any whitespace (tabs, space, form feed, newline,
|
||||||
* carriage return, etc) removed from the beginning and end.
|
* carriage return, etc) removed from the beginning and end.
|
||||||
|
@ -10864,6 +11297,44 @@ declare class Pin {
|
||||||
*/
|
*/
|
||||||
toggle(): boolean;
|
toggle(): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Added in 2v20) Pulse the pin with the value for the given time in milliseconds.
|
||||||
|
* ```
|
||||||
|
* LED.pulse(1, 100); // pulse LED on for 100ms
|
||||||
|
* LED.pulse(1, [100,1000,100]); // pulse LED on for 100ms, off for 1s, on for 100ms
|
||||||
|
* ```
|
||||||
|
* This is identical to `digitalPulse`.
|
||||||
|
*
|
||||||
|
* @param {boolean} value - Whether to pulse high (true) or low (false)
|
||||||
|
* @param {any} time - A time in milliseconds, or an array of times (in which case a square wave will be output starting with a pulse of 'value')
|
||||||
|
* @url http://www.espruino.com/Reference#l_Pin_pulse
|
||||||
|
*/
|
||||||
|
pulse(value: boolean, time: any): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Added in 2v20) Get the analogue value of the given pin. See `analogRead` for more information.
|
||||||
|
* @returns {number} The analog Value of the Pin between 0 and 1
|
||||||
|
* @url http://www.espruino.com/Reference#l_Pin_analog
|
||||||
|
*/
|
||||||
|
analog(): number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Added in 2v20) Set the analog Value of a pin. It will be output using PWM.
|
||||||
|
* See `analogWrite` for more information.
|
||||||
|
* Objects can contain:
|
||||||
|
* * `freq` - pulse frequency in Hz, e.g. ```analogWrite(A0,0.5,{ freq : 10 });``` -
|
||||||
|
* specifying a frequency will force PWM output, even if the pin has a DAC
|
||||||
|
* * `soft` - boolean, If true software PWM is used if hardware is not available.
|
||||||
|
* * `forceSoft` - boolean, If true software PWM is used even if hardware PWM or a
|
||||||
|
* DAC is available
|
||||||
|
*
|
||||||
|
* @param {number} value - A value between 0 and 1
|
||||||
|
* @param {any} options
|
||||||
|
* An object containing options for analog output - see below
|
||||||
|
* @url http://www.espruino.com/Reference#l_Pin_pwm
|
||||||
|
*/
|
||||||
|
pwm(value: number, options: any): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get information about this pin and its capabilities. Of the form:
|
* Get information about this pin and its capabilities. Of the form:
|
||||||
* ```
|
* ```
|
||||||
|
@ -11623,6 +12094,9 @@ declare function analogRead(pin: Pin): number;
|
||||||
* * `soft` - boolean, If true software PWM is used if hardware is not available.
|
* * `soft` - boolean, If true software PWM is used if hardware is not available.
|
||||||
* * `forceSoft` - boolean, If true software PWM is used even if hardware PWM or a
|
* * `forceSoft` - boolean, If true software PWM is used even if hardware PWM or a
|
||||||
* DAC is available
|
* DAC is available
|
||||||
|
* On nRF52-based devices (Puck.js, Pixl.js, MDBT42Q, etc) hardware PWM runs at
|
||||||
|
* 16MHz, with a maximum output frequency of 4MHz (but with only 2 bit (0..3) accuracy).
|
||||||
|
* At 1Mhz, you have 4 bits (0..15), 1kHz = 14 bits and so on.
|
||||||
* **Note:** if you didn't call `pinMode` beforehand then this function will also
|
* **Note:** if you didn't call `pinMode` beforehand then this function will also
|
||||||
* reset pin's state to `"output"`
|
* reset pin's state to `"output"`
|
||||||
*
|
*
|
||||||
|
@ -13309,6 +13783,7 @@ declare module "fs" {
|
||||||
function mkdirSync(path: any): boolean;
|
function mkdirSync(path: any): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Pipe this file to a destination stream (object which has a `.write(data)` method).
|
||||||
*
|
*
|
||||||
* @param {any} source - The source file/stream that will send content.
|
* @param {any} source - The source file/stream that will send content.
|
||||||
* @param {any} destination - The destination file/stream that will receive content from the source.
|
* @param {any} destination - The destination file/stream that will receive content from the source.
|
||||||
|
@ -13394,12 +13869,23 @@ declare module "tensorflow" {
|
||||||
* Functions here take and return buffers of data. There is no support for
|
* Functions here take and return buffers of data. There is no support for
|
||||||
* streaming, so both the compressed and decompressed data must be able to fit in
|
* streaming, so both the compressed and decompressed data must be able to fit in
|
||||||
* memory at the same time.
|
* memory at the same time.
|
||||||
|
* ```
|
||||||
|
* var c = require("heatshrink").compress("Hello World");
|
||||||
|
* // =new Uint8Array([....]).buffer
|
||||||
|
* var d = require("heatshrink").decompress(c);
|
||||||
|
* // =new Uint8Array([72, 101, ...]).buffer
|
||||||
|
* E.toString(d)
|
||||||
|
* // ="Hello World"
|
||||||
|
* ```
|
||||||
* If you'd like a way to perform compression/decompression on desktop, check out https://github.com/espruino/EspruinoWebTools#heatshrinkjs
|
* If you'd like a way to perform compression/decompression on desktop, check out https://github.com/espruino/EspruinoWebTools#heatshrinkjs
|
||||||
* @url http://www.espruino.com/Reference#heatshrink
|
* @url http://www.espruino.com/Reference#heatshrink
|
||||||
*/
|
*/
|
||||||
declare module "heatshrink" {
|
declare module "heatshrink" {
|
||||||
/**
|
/**
|
||||||
* Compress the heatshrink-encoded data supplied as input.
|
* Compress the data supplied as input, and return heatshrink encoded data as an ArrayBuffer.
|
||||||
|
* No type information is stored, and the `data` argument is treated as an array of bytes
|
||||||
|
* (whether it is a `String`/`Uint8Array` or even `Uint16Array`), so the result of
|
||||||
|
* decompressing any compressed data will always be an ArrayBuffer.
|
||||||
* If you'd like a way to perform compression/decompression on desktop, check out https://github.com/espruino/EspruinoWebTools#heatshrinkjs
|
* If you'd like a way to perform compression/decompression on desktop, check out https://github.com/espruino/EspruinoWebTools#heatshrinkjs
|
||||||
*
|
*
|
||||||
* @param {any} data - The data to compress
|
* @param {any} data - The data to compress
|
||||||
|
@ -13409,11 +13895,12 @@ declare module "heatshrink" {
|
||||||
function compress(data: any): ArrayBuffer;
|
function compress(data: any): ArrayBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decompress the heatshrink-encoded data supplied as input.
|
* Decompress the heatshrink-encoded data supplied as input, and return it as an `ArrayBuffer`.
|
||||||
|
* To get the result as a String, wrap `require("heatshrink").decompress` in `E.toString`: `E.toString(require("heatshrink").decompress(...))`
|
||||||
* If you'd like a way to perform compression/decompression on desktop, check out https://github.com/espruino/EspruinoWebTools#heatshrinkjs
|
* If you'd like a way to perform compression/decompression on desktop, check out https://github.com/espruino/EspruinoWebTools#heatshrinkjs
|
||||||
*
|
*
|
||||||
* @param {any} data - The data to decompress
|
* @param {any} data - The data to decompress
|
||||||
* @returns {any} Returns the result as an ArrayBuffer
|
* @returns {any} Returns the result as an `ArrayBuffer`
|
||||||
* @url http://www.espruino.com/Reference#l_heatshrink_decompress
|
* @url http://www.espruino.com/Reference#l_heatshrink_decompress
|
||||||
*/
|
*/
|
||||||
function decompress(data: any): ArrayBuffer;
|
function decompress(data: any): ArrayBuffer;
|
||||||
|
@ -13520,7 +14007,8 @@ declare module "Storage" {
|
||||||
/**
|
/**
|
||||||
* Erase a single file from the flash storage area.
|
* Erase a single file from the flash storage area.
|
||||||
* **Note:** This function should be used with normal files, and not `StorageFile`s
|
* **Note:** This function should be used with normal files, and not `StorageFile`s
|
||||||
* created with `require("Storage").open(filename, ...)`
|
* created with `require("Storage").open(filename, ...)`. To erase those, use
|
||||||
|
* `require("Storage").open(..., "r").erase()`.
|
||||||
*
|
*
|
||||||
* @param {any} name - The filename - max 28 characters (case sensitive)
|
* @param {any} name - The filename - max 28 characters (case sensitive)
|
||||||
* @url http://www.espruino.com/Reference#l_Storage_erase
|
* @url http://www.espruino.com/Reference#l_Storage_erase
|
||||||
|
@ -13596,9 +14084,12 @@ declare module "Storage" {
|
||||||
* try and overwrite data that already exists**. For instance:
|
* try and overwrite data that already exists**. For instance:
|
||||||
* ```
|
* ```
|
||||||
* var f = require("Storage");
|
* var f = require("Storage");
|
||||||
* f.write("a","Hello",0,14);
|
* f.write("a","Hello",0,14); // Creates a new file, 14 chars long
|
||||||
* f.write("a"," ",5);
|
* print(JSON.stringify(f.read("a"))); // read the file
|
||||||
* f.write("a","World!!!",6);
|
* // any nonwritten chars will be char code 255:
|
||||||
|
* "Hello\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF"
|
||||||
|
* f.write("a"," ",5); // write within the file
|
||||||
|
* f.write("a","World!!!",6); // write again within the file
|
||||||
* print(f.read("a")); // "Hello World!!!"
|
* print(f.read("a")); // "Hello World!!!"
|
||||||
* f.write("a"," ",0); // Writing to location 0 again will cause the file to be re-written
|
* f.write("a"," ",0); // Writing to location 0 again will cause the file to be re-written
|
||||||
* print(f.read("a")); // " "
|
* print(f.read("a")); // " "
|
||||||
|
@ -13611,7 +14102,7 @@ declare module "Storage" {
|
||||||
*
|
*
|
||||||
* @param {any} name - The filename - max 28 characters (case sensitive)
|
* @param {any} name - The filename - max 28 characters (case sensitive)
|
||||||
* @param {any} data - The data to write
|
* @param {any} data - The data to write
|
||||||
* @param {number} [offset] - [optional] The offset within the file to write
|
* @param {number} [offset] - [optional] The offset within the file to write (if `0`/`undefined` a new file is created, otherwise Espruino attempts to write within an existing file if one exists)
|
||||||
* @param {number} [size] - [optional] The size of the file (if a file is to be created that is bigger than the data)
|
* @param {number} [size] - [optional] The size of the file (if a file is to be created that is bigger than the data)
|
||||||
* @returns {boolean} True on success, false on failure
|
* @returns {boolean} True on success, false on failure
|
||||||
* @url http://www.espruino.com/Reference#l_Storage_write
|
* @url http://www.espruino.com/Reference#l_Storage_write
|
||||||
|
@ -13623,9 +14114,15 @@ declare module "Storage" {
|
||||||
* disappear when the device resets or power is lost.
|
* disappear when the device resets or power is lost.
|
||||||
* Simply write `require("Storage").writeJSON("MyFile", [1,2,3])` to write a new
|
* Simply write `require("Storage").writeJSON("MyFile", [1,2,3])` to write a new
|
||||||
* file, and `require("Storage").readJSON("MyFile")` to read it.
|
* file, and `require("Storage").readJSON("MyFile")` to read it.
|
||||||
* This is equivalent to: `require("Storage").write(name, JSON.stringify(data))`
|
* This is (almost) equivalent to `require("Storage").write(name, JSON.stringify(data))` (see the notes below)
|
||||||
* **Note:** This function should be used with normal files, and not `StorageFile`s
|
* **Note:** This function should be used with normal files, and not `StorageFile`s
|
||||||
* created with `require("Storage").open(filename, ...)`
|
* created with `require("Storage").open(filename, ...)`
|
||||||
|
* **Note:** Normally `JSON.stringify` converts any non-standard character to an escape code with `\uXXXX`, but
|
||||||
|
* as of Espruino 2v20, when writing to a file we use the most compact form, like `\xXX` or `\X`, as well as
|
||||||
|
* skipping quotes on fields. This saves space and is faster, but also means that if a String wasn't a UTF8
|
||||||
|
* string but contained characters in the UTF8 codepoint range, when saved it won't end up getting reloaded as a UTF8 string.
|
||||||
|
* It does mean that you cannot parse the file with just `JSON.parse` as it's no longer standard JSON but is JS,
|
||||||
|
* so you must use `Storage.readJSON`
|
||||||
*
|
*
|
||||||
* @param {any} name - The filename - max 28 characters (case sensitive)
|
* @param {any} name - The filename - max 28 characters (case sensitive)
|
||||||
* @param {any} data - The JSON data to write
|
* @param {any} data - The JSON data to write
|
||||||
|
@ -13692,9 +14189,11 @@ declare module "Storage" {
|
||||||
* become garbled when compaction happens. To avoid this, call `eraseFiles` before
|
* become garbled when compaction happens. To avoid this, call `eraseFiles` before
|
||||||
* uploading data that you intend to reference to ensure that uploaded files are
|
* uploading data that you intend to reference to ensure that uploaded files are
|
||||||
* right at the start of flash and cannot be compacted further.
|
* right at the start of flash and cannot be compacted further.
|
||||||
|
*
|
||||||
|
* @param {boolean} [showMessage] - [optional] If true, an overlay message will be displayed on the screen while compaction is happening. Default is false.
|
||||||
* @url http://www.espruino.com/Reference#l_Storage_compact
|
* @url http://www.espruino.com/Reference#l_Storage_compact
|
||||||
*/
|
*/
|
||||||
function compact(): void;
|
function compact(showMessage?: boolean): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This writes information about all blocks in flash memory to the console - and is
|
* This writes information about all blocks in flash memory to the console - and is
|
||||||
|
@ -13707,10 +14206,13 @@ declare module "Storage" {
|
||||||
* Return the amount of free bytes available in Storage. Due to fragmentation there
|
* Return the amount of free bytes available in Storage. Due to fragmentation there
|
||||||
* may be more bytes available, but this represents the maximum size of file that
|
* may be more bytes available, but this represents the maximum size of file that
|
||||||
* can be written.
|
* can be written.
|
||||||
|
* **NOTE:** `checkInternalFlash` is only useful on DICKENS devices - other devices don't use two different flash banks
|
||||||
|
*
|
||||||
|
* @param {boolean} checkInternalFlash - Check the internal flash (rather than external SPI flash). Default false, so will check external storage
|
||||||
* @returns {number} The amount of free bytes
|
* @returns {number} The amount of free bytes
|
||||||
* @url http://www.espruino.com/Reference#l_Storage_getFree
|
* @url http://www.espruino.com/Reference#l_Storage_getFree
|
||||||
*/
|
*/
|
||||||
function getFree(): number;
|
function getFree(checkInternalFlash: boolean): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns:
|
* Returns:
|
||||||
|
@ -13724,10 +14226,13 @@ declare module "Storage" {
|
||||||
* trashCount // How many trash files do we have? (can be cleared with .compact)
|
* trashCount // How many trash files do we have? (can be cleared with .compact)
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
|
* **NOTE:** `checkInternalFlash` is only useful on DICKENS devices - other devices don't use two different flash banks
|
||||||
|
*
|
||||||
|
* @param {boolean} checkInternalFlash - Check the internal flash (rather than external SPI flash). Default false, so will check external storage
|
||||||
* @returns {any} An object containing info about the current Storage system
|
* @returns {any} An object containing info about the current Storage system
|
||||||
* @url http://www.espruino.com/Reference#l_Storage_getStats
|
* @url http://www.espruino.com/Reference#l_Storage_getStats
|
||||||
*/
|
*/
|
||||||
function getStats(): any;
|
function getStats(checkInternalFlash: boolean): any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a lookup table for files into Bangle.js's storage. This allows any file
|
* Writes a lookup table for files into Bangle.js's storage. This allows any file
|
||||||
|
|
Loading…
Reference in New Issue