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 whereoffsetis the offset to provide the API request -
api.projects.tagged(tag, offset)returns an array of the top projects of a certain tag wheretagis a tag to search for andoffsetis the offset to provide the API request -
api.projects.trending(offset)returns an array of the top trending projects whereoffsetis the offset to provide the API request -
api.projects.topLoved(offset)returns an array of the top loved projects whereoffsetis the offset to provide the API request -
api.projects.featured(offset)returns an array of the featured project whereoffsetis the offset to provide the API request -
api.search.general(query, offset)returns an array of search results wherequeryis a URI-encoded string to search andoffsetis the offset to provide the API request -
api.project.metadata(id)returns a single project object whereidis 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 whereidis the project's ID,usernameis the project's author's Scratch username, andoffsetis the offset to provide the API request
This module handles all repetitive DOM manipulation tasks
DOCUMENTATION TODO