ResourceConfig

An interface describing how to retrieve and manage persistently stored resources.

Resources are JSON documents stored in a persistent manner (and synced accross devices if using the Sync add on).

MindDrop's core is responsible for retrieving and managing persistent resources. Resource types can be registered using the core.registerResource method. See the Core API page for more details.

PropertyTypeDescription
type*string A unique identifier for the type of the resource composed using the extension ID and resource type: [extensionId]:[resourceType]. For example, topics have a type of 'topics:topic'.
onLoadResourceLoadHandlerA callback fired once when the resources are loaded on app startup. See below for details.
onChangeResourceChangeHandlerA callback fired whenever a resource matching the given type is added, updated, or deleted. See below for details.
createEventstring If provided, an event listener will be added for this event type. When such an event is fired, the attached resource will be added to the persistent store. The event data must be the resource itself.
updateEventstring If provided, an event listener will be added for this event type. When such an event is fired, the attached resource will be updated in the persistent store. The event data must be a ResourceChange (see below for details).
deleteEventstring If provided, an event listener will be added for this event type. When such an event is fired, the attached resource will be permanently deleted from the persistent store. The event data must be the resource itself.

A callback fired once when the resources are loaded on app startup.

onLoad(core: Core, resources: Resouce[]): void;
ArgumentTypeDescription
core*CoreA MindDrop core instance.
resources*[Resource]The resources which were loaded from the persistent store.

A callback fired whenever a resource matching the given type is added, updated, or deleted.

onChange(core: Core, resource: Resouce, deleted: boolean): void;
ArgumentTypeDescription
core*CoreA MindDrop core instance.
resource*[Resource]The resource which changed.
deleted*boolean If true, the resource has been permanently deleted.
PropertyTypeDescription
before[Resource]The resource data before it was changed.
after[Resource]The resource data after it was changed.
changes[ResourceChanges] The changes applied to the resource data. Supports FieldValue values.