TinyBase logoTinyBase

getValuesSchemaJson

The getValuesSchemaJson method returns a string serialization of the ValuesSchema of the Store.

getValuesSchemaJson(): string
returnsstring

A string serialization of the ValuesSchema of the Store.

If no ValuesSchema has been set on the Store (or if it has been removed with the delValuesSchema method), then it will return the serialization of an empty object, {}.

Examples

This example serializes the ValuesSchema of a Store.

const store = createStore().setValuesSchema({
  open: {type: 'boolean', default: false},
});
console.log(store.getValuesSchemaJson());
// -> '{"open":{"type":"boolean","default":false}}'

This example serializes the ValuesSchema of an empty Store.

const store = createStore();
console.log(store.getValuesSchemaJson());
// -> '{}'

Since

v3.0.0