delValues
The delValues
method lets you remove all the Values
from a Store
.
delValues(): this
returns | this | A reference to the |
---|
If there is a ValuesSchema
applied to the Store
and it specifies a default value for any Value
Id
, then deletion will result in it being set back to its default value.
Examples
This example removes all Values
from a Store
without a ValuesSchema
.
import {createStore} from 'tinybase';
const store = createStore().setValues({open: true, employees: 3});
store.delValues();
console.log(store.getValues());
// -> {}
This example removes all Values
from a Store
with a ValuesSchema
that defaults one of its values.
import {createStore} from 'tinybase';
const store = createStore()
.setValues({open: true, employees: 3})
.setValuesSchema({
open: {type: 'boolean', default: false},
employees: {type: 'number'},
});
store.delValues();
console.log(store.getValues());
// -> {open: false}
Since
v3.0.0