LogoRobo.js
Framework

Flashcore

Variable: Flashcore

const Flashcore: {
  $init: (options) => Promise<void>;
  clear: () => boolean | void | Promise<void> | Promise<boolean>;
  delete: (key, options?) => boolean | Promise<boolean>;
  get: <V>(key, options?) => V | Promise<V>;
  has: (key, options?) => boolean | Promise<boolean>;
  off: (key, callback?, options?) => void;
  on: (key, callback, options?) => void;
  set: <V>(key, value, options?) => boolean | Promise<boolean>;
};

Built-in KV database for long-term storage.

import { Flashcore } from 'robo.js'

await Flashcore.set('key', 'value')
const value = await Flashcore.get('key')
await Flashcore.delete('key')

Use this to store and retrieve data across sessions. All APIs are asynchronous. Defaults to file-based storage, but can be configured to use other engines using Keyv adapters.

Learn more: Flashcore Database

Type declaration

NameTypeDescription
$init(options) => Promise<void>Prepares Flashcore for usage. This must be called before using any other Flashcore functions. Can only be called once per process.
clear() => boolean | void | Promise<void> | Promise<boolean>Clears all key-value pairs from the store.
delete(key, options?) => boolean | Promise<boolean>Deletes the value associated with a key from the store.
get<V>(key, options?) => V | Promise<V>Gets the value associated with a key.
has(key, options?) => boolean | Promise<boolean>Checks if a key exists in the store.
off(key, callback?, options?) => voidUnregisters a callback from a key, so it will no longer be executed when the key's value changes.
on(key, callback, options?) => voidRegisters a callback to be executed when a specific key's value changes in the store.
set<V>(key, value, options?) => boolean | Promise<boolean>Sets a key-value pair in the store.

On this page