Members
(constant) @private :string
JSDoc comment for this constant.
- Source:
Type:
-
string
(constant) params
Retrieve GET queries for current recipe.
/recipe.html?source=placeholder&id=index
See https://developer.mozilla.org/en-US/docs/Web/API/URL/searchParams
- Source:
(constant) recipeJSON
LD-JSON structured data storing recipe data in the document head.
- Source:
(constant) source
Either 'user' to specify a user recipe, or an external source
like 'delicious.com.au' to specify a preset recipe.
- Source:
(constant) userRecipes
Access local storage to retrieve recipe data.
- Source:
Methods
activateDrawerEditing()
Activate editing functionality in the drawer.
- Source:
caloriesNinjasNutritions(query) → {Array}
Get a detailed list of nutrition information for each item from an input text query.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
query |
string
|
the text query that contains recipe information |
Returns:
- Type:
-
Array
An array of items given by the queries with the detailed nurtitions
createIngredientList(ingredientArr) → {string}
Takes in a list of ingredients raw from imported data and returns a neatly
formatted comma separated list.
Parameters:
Name | Type | Description |
---|---|---|
ingredientArr |
Array.<string>
|
The raw unprocessed array of ingredients from the imported data. |
Returns:
- Type:
-
string
The string comma separate list of ingredients from the array.
createTagList(data) → {Object|Array|string}
Takes in a list of ingredients raw from imported data and returns a neatly
formatted comma separated list.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object
|
The recipe data object to search through. |
Returns:
-
- Type:
-
Object
tagList - An object storing the tags in array and string format. -
- Type:
-
Array
tagList.array - Array of tags -
- Type:
-
string
tagList.string - String of tags
deleteCornerBtns(btnIds)
Deletes specified corner buttons.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
btnIds |
Array.<string>
|
IDs of buttons to delete. {'bookmarkBtn','addBtn', 'editBtn', 'deleteBtn'} |
getIngredientInfo(id) → {Object}
Use an ingredient id to get all available information about an ingredient, such as its image and supermarket aisle.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
id |
number
|
The ingredient id. |
Returns:
- Type:
-
Object
A JavaScript object that contains all the information of the given ingredient
getIngredientSubstitutes(name) → {Object}
Search for substitutes for a given ingredient.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
name |
string
|
The ingredient id. |
Returns:
- Type:
-
Object
A JavaScript object that contains all the substitutes for a given ingredient.
getRecipeInformation(id) → {Object}
Use a recipe id to get full information about a recipe, such as ingredients, nutrition, diet and allergen information, etc.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
id |
number
|
A JavaScript object that contains different types of params given in https://spoonacular.com/food-api/docs#Search-Recipes-Complex |
Returns:
- Type:
-
Object
A JavaScript object that contains all the information of the given recipe
getSimilarRecipe(id) → {Object}
Find recipes which are similar to the given one.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
id |
number
|
The recipe id. |
Returns:
- Type:
-
Object
A JavaScript object that contains all the results in an array
ingredientsSearch(query) → {Object}
Search for simple whole foods (e.g. fruits, vegetables, nuts, grains, meat, fish, dairy etc.).
- Source:
Parameters:
Name | Type | Description |
---|---|---|
query |
string
|
The partial or full ingredient name. |
Returns:
- Type:
-
Object
A JavaScript object that contains all the information of the query
initializeDrawer()
Toggle expand button visibility based on drawer visibility.
initializeServiceWorker()
PWA/SPA ABANDONED:
Detects if there's a service worker, then loads it and begins the process
of installing it and getting it running.
invalidRecipe()
Replaces recipe content with 404 message if there is no valid specified recipe to load.
- Source:
parseISO(isoString) → {string}
Takes in a list of ingredients raw from imported data and returns a neatly
formatted comma separated list.
Parameters:
Name | Type | Description |
---|---|---|
isoString |
string
|
The ISO 8601 string to be parsed. |
Returns:
- Type:
-
string
The duration in a human-readable format (# hr # min).
populateRecipe(data)
Populates recipe content with recipe data.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
data |
Object
|
Recipe data. |
searchForKey(object, key) → {*}
Recursively search for a key nested somewhere inside an object
Parameters:
Name | Type | Description |
---|---|---|
object |
Object
|
The object with which you'd like to search. |
key |
string
|
The key that you are looking for in the object. |
Returns:
- Type:
-
*
The value of the found key.
searchRecipe(params) → {Object}
Search through hundreds of thousands of recipes using advanced filtering and ranking. NOTE: This method combines searching by query, by ingredients, and by nutrients into one endpoint.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
A JavaScript object that contains different types of params given in https://spoonacular.com/food-api/docs#Search-Recipes-Complex |
Returns:
- Type:
-
Object
A JavaScript object that contains all the results in an array