Implementing the getMediaCollectionIdentifiersList method

This method will simply return an array containing all the keys in the store. This will come in handy later when we work on the UI, in order to allow us to load the existing collections.

The following is the relevant code:

getMediaCollectionIdentifiersList(): Promise<string[]> { 
    return new Promise<string[]>((resolve, reject) => { 
        console.log("Retrieving the list of media collection 
identifiers"); this._store.keys().then(keys => { console.log(`Retrieved the of media collection
identifiers:
${keys}`); resolve(keys); }) .catch(err => { console.error(`Failed to retrieve the list of media
collection identifiers. Error: ${err}`); reject(err); }) }); }

This is, of course, very similar to what we've just done in the preceding section. The main difference the following is that we use the keys() method, which returns the list of keys, as described in the localForage documentation: https://localforage.github.io/localForage/#data-api-keys.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.19.56.114