Releases: JankieQwQ/SA.js
SA.js v0.1.0
SA.JS Version 0.1.0
find(): Promise
Performs the search operation and returns a Promise object that resolves with the result or rejects with an error.
findMultiple(page = 0, perPage = 10): Promise
Performs a search operation and returns multiple results. It allows you to specify the page number and the number of results per page.
page
(number): The page number to retrieve results from (default is 0).perPage
(number): The number of results per page (default is 10).
searchInCurrentPage(url, findtext): Promise
A helper function that performs a search operation within the entire content of a web page.
url
(string): The URL of the web page to search for content.findtext
(string): The text to search for.
searchInPage(url, findtext, page, perPage): Promise
A helper function that performs a search operation within a specific DOM element of a web page. It allows you to specify the page number and the number of results per page.
url
(string): The URL of the web page to search for content.findtext
(string): The text to search for.page
(number): The page number to retrieve results from.perPage
(number): The number of results per page.
Caching
SA.js implements a simple caching mechanism to store the fetched web page content. This helps to improve performance by avoiding unnecessary requests for the same web page. The cache is implemented using a Map
object.
DOM Search
SA.js uses the DOMParser
API to parse the web page content into a Document
object. This allows for efficient searching within specific DOM elements, specified using CSS selectors.