Class: RecipeStore

RecipeStore()

Class representing the store interface for recipes in IndexedDB

Constructor

new RecipeStore()

Create a RecipeStore object.
Source:

Classes

RecipeStore

Methods

(async) addRecipe(data) → {Promise.<number>}

Adds a recipe to app's IndexedDB database.
Parameters:
Name Type Description
data Object Recipe data (similar to Google's recipe schema).
Source:
Returns:
- A Promise that resolves to new recipe's ID number.
Type
Promise.<number>

(async) deleteRecipe(data)

Removes an existing recipe entry from the app's IndexedDB database.
Parameters:
Name Type Description
data Object An object of the target recipe
Source:

(async) getAllRecipes() → {Promise.<Array.<Object>>}

Retrieves all recipes from the app's IndexedDB database.
Source:
Returns:
- A promise that resolves to an array of recipe Objects.
Type
Promise.<Array.<Object>>

(async) getRecipe(id) → {Promise.<Object>}

Retrieves a recipe from the app's IndexedDB database.
Parameters:
Name Type Description
id number A number corresponding to the target recipe's id.
Source:
Returns:
- A Promise that resolves to the recipe Object.
Type
Promise.<Object>

(async) getRecipeImageURL(id) → {Promise.<string>}

Retrieves a recipe's image from the app's IndexedDB database.
Parameters:
Name Type Description
id number A number corresponding to the target recipe's id.
Source:
Returns:
- A Promise that resolves to an Object URL (via `URL.createObjectURL`) for use in tags.
Type
Promise.<string>

(async) updateRecipe(id, data) → {Promise.<number>}

Updates an existing recipe entry in the app's IndexedDB database.
Parameters:
Name Type Description
id number A number corresponding to the target recipe's id.
data Object New recipe data to replace the old entry's data (similar to Google's recipe schema).
Source:
Returns:
- A Promise that resolves to new recipe's ID number.
Type
Promise.<number>