Global

Methods

createFilter(name, label, options) → {HTMLElement}

Creates a dropdown filter based on an attribute of a recipe
Parameters:
Name Type Description
name string Name of the filter
label string Type of filter
options Array Options in filter
Source:
Returns:
- returns an HTMLElement containing a select tag for a filter
Type
HTMLElement

createIngredientFilter(name, label) → {HTMLElement}

Creates the ingredient dropdown filter with search bar
Parameters:
Name Type Description
name string Filter name
label string Label of filter
Source:
Returns:
- returns an HTMLElement containing the ingredient filter with a search bar
Type
HTMLElement

displayRecipes(recipes)

Renders recipe cards in the main section.
Parameters:
Name Type Description
recipes Array.<Object> Array of recipe metadata objects.
Source:

FilterByMealType(ingredient)

Filters and displays recipes that include a specific ingredient.
Parameters:
Name Type Description
ingredient string Ingredient to filter recipes by.
Source:

filterMetadata(filters) → {Array.<Object>}

Filters stored recipe metadata based on the provided filter criteria.
Parameters:
Name Type Description
filters Object An object representing filters to apply (e.g., category, cuisine, time).
Source:
Returns:
- An array of metadata objects that match the filter.
Type
Array.<Object>

getAllMetadata() → {Array.<Object>}

Retrieves all recipe metadata entries from localStorage.
Source:
Returns:
- An array of metadata objects stored in localStorage.
Type
Array.<Object>

getFromStorage() → {Array.<Object>}

(Unused) Gets recipe data from localStorage.
Source:
Returns:
Array of recipes or empty array if none found.
Type
Array.<Object>

handleCreate()

Handles form submission, builds recipe object, and saves it to storage.
Source:

init()

Initializes the recipe creation page and sets up form handling.
Source:

init()

Initializes the recipe view by loading metadata and displaying recipes.
Source:

(async) loadRecipeDetails(recipeId, recipeCard, ingredientsList, instructionsList)

This is an asynchronous function for loading the recipe details from the database
Parameters:
Name Type Description
recipeId string
recipeCard HTMLElement
ingredientsList HTMLElement
instructionsList HTMLElement
Source:

render()

This function renders the home page and reroutes to the correct pages through the URL
Source:

renderCardDetails(id) → {null}

This function reroutes to the details page(viewing the recipe).
Parameters:
Name Type Description
id string
Source:
Returns:
returns nothing if recipe id is invalid
Type
null

Type Definitions

routes

Type:
  • Object
Properties:
Name Type Description
'/' function Route to home page
'/create' function Route to create a recipe page
'/details' function Route to viewing a recipe page
Source: