Edit this topic

Content storage manager

: request

: storage-manager

: content

: /modules/core/content/services/content-storage-manager.js

: https://github.com/DecentCMS/DecentCMS/blob/master/modules/core/content/services/content-storage-manager.js


The ContentStorageManager is responsible for the content retrieval.

contentStorageManager.promiseToGet(id, [callback])

Promises to get one or several content items.

Param Type Description
id Array.<string> the id or ids of the items to fetch.
[callback] function A function with signature (err, item) that will get called once per item once the item has been loaded.

contentStorageManager.getAvailableItem(id) ⇒ object

Gets an item from the collection of items that the content manager has already fetched. If not found, null, is returned.

Returns: object - The content item, or null if not found.

Param Type Description
id string The id of the item to fetch.

contentStorageManager.fetchContent(context, [callback])

Triggers the asynchronous fetching of the items whose ids can be found in the content manager's itemsToFetch array, and their transfer into the items array. This method emits the decent.core.load-items event.

Param Type Description
context object the context.
[context.request] object the current request
[callback] function a callback that gets called when all items have been fetched, or when an error occurs.