This repository was archived by the owner on Jan 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
JavaScript modules
Micah Lindley edited this page Nov 8, 2020
·
1 revision
There are two primary JavaScript modules that we use. These are not external scripts, but ones written especially for Itchy and designed to be reusable across the application.
This module handles all requests to the Scratch API as well as to our search API. We ask that when using it you import it as api
to standardize it across the different JavaScript files. It provides the following functions, all of which are asynchronous and should be used in the context of .then()
.
-
api.projects.recent(offset)
returns an array of the most recently shared projects whereoffset
is the offset to provide the API request -
api.projects.tagged(tag, offset)
returns an array of the top projects of a certain tag wheretag
is a tag to search for andoffset
is the offset to provide the API request -
api.projects.trending(offset)
returns an array of the top trending projects whereoffset
is the offset to provide the API request -
api.projects.topLoved(offset)
returns an array of the top loved projects whereoffset
is the offset to provide the API request -
api.projects.featured(offset)
returns an array of the featured project whereoffset
is the offset to provide the API request -
api.search.general(query, offset)
returns an array of search results wherequery
is a URI-encoded string to search andoffset
is the offset to provide the API request -
api.project.metadata(id)
returns a single project object whereid
is the project ID to provide the API request -
api.project.comments(id, username, offset)
returns an array of the most recent comments on a project whereid
is the project's ID,username
is the project's author's Scratch username, andoffset
is the offset to provide the API request
This module handles all repetitive DOM manipulation tasks
DOCUMENTATION TODO