Class: AbstractProviderByAsyncDirectory

AbstractProviderByAsyncDirectory

(abstract) new AbstractProviderByAsyncDirectory(directory, options)

Provides an item by loading all of the files in a directory Items are loaded asynchronously but if an item is requested before being loaded it will be immediately loaded and then skipped by the asychronous processing.
Parameters:
Name Type Description
directory String The directory to read all items from
options Object.<String, Object> Options for configuration. This can also be used as a map to pass to the itemProcessor if the implementing class wants to pass information into the itemProcessor method
Properties
Name Type Attributes Default Description
filenameFormatter FilenameFormatter <optional>
DefaultJSFilenameFormatter The FilenameFormmatter to use to parse the filenames to determine item file name as well as how to format the itemId to become a filename. This object will only load files that match the formatters isValid() method
fileEncoding String <optional>
utf8 The file encoding to use when reading files and directories
itemMap Object.<String, Object> <optional>
A map that may be passed in to prime the internal map with.
Implements:
Source:

Methods

getItem(itemId) → {Object}

Returns the item based on the itemId
Parameters:
Name Type Description
itemId String The id of the item to retrieve. If the item is not already loaded, it will load it
Implements:
Source:
Returns:
The item. Null if no item is found
Type
Object

getItems() → {Map}

Returns all items that were loaded
Implements:
Source:
Returns:
Map of the items where the Key is the itemId and the Value is the item itself
Type
Map

(abstract) processItem(items, itemId, fileName, options)

Processes the specific item and returns the result
Parameters:
Name Type Description
items Map Map of the items being processed
itemId String The Id of the item to process
fileName String The name of the file being processed
options Object Any options that are being passed to the ItemProcessor (can be null)
Implements:
Source:

(abstract) processItems(items, fileName, options)

Processes multiple items at once
Parameters:
Name Type Description
items Map Map of the items being processed
fileName String The name of the file being processed
options Object Any options that are being passed to the ItemProcessor (can be null)
Implements:
Source: