initial blocks for storage

This commit is contained in:
Peli de Halleux
2016-04-16 07:45:04 -07:00
parent 8fb96934ca
commit 4795c58e97
5 changed files with 79 additions and 1 deletions

View File

@ -585,4 +585,36 @@ declare interface Buffer {
write(dstOffset: number, src: Buffer): void;
}
/**
* Allows to save and read values in the flash storage
*/
//% weight=10 color=#cc6600
declare namespace storage {
/**
* Writes the key and buffer pair into flash.
*/
//% blockId="storage_put_buffer" block="storage put buffer %key|with %buffer" weight=50 shim=storage::putBuffer
function putBuffer(key: string, buffer: Buffer): void;
/**
* Gets the buffer at the given key if any. If no key is available, empty buffer is returned.
*/
//% blockId="storage_get_buffer" block="storage get buffer %key" weight=49 shim=storage::getBuffer
function getBuffer(key: string): Buffer;
/**
* Removes an entry identified by the key.
*/
//% blockId="storage_remove" block="storage remove %key" weight=20 shim=storage::remove
function remove(key: string): void;
/**
* The number of entries in the key value store
*/
//% blockId="storage_size" block="storage size" weight=10 shim=storage::size
function size(): number;
}
// Auto-generated. Do not edit. Really.