From f4ee98f8c8149891eef5fc76b2a1d33d95d653d3 Mon Sep 17 00:00:00 2001 From: Thedogecraft Date: Fri, 19 Jul 2024 19:16:35 -0700 Subject: [PATCH] Update readme.md --- readme.md | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 9c81ca9..2850aec 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,3 @@ - # CloakJS: Simplifying Tab Cloaking with JavaScript CloakJS is a lightweight JavaScript library designed for easy tab cloaking. @@ -59,4 +58,45 @@ To configure cloaks on your page: ``` +### Using CloakJS APIs + +You can use the following APIs with CloakJS: + +- **getTitle()**: Get the current document title. + + Example: + ```javascript + const title = cloak.getTitle(); + console.log(title); // Outputs the current title of the document + ``` + +- **setTitle(newTitle)**: Set a new document title. + + Example: + ```javascript + cloak.setTitle("New Title"); + ``` + +- **getFavicon()**: Get the current favicon URL. + + Example: + ```javascript + const favicon = cloak.getFavicon(); + console.log(favicon); // Outputs the current favicon URL + ``` + +- **setFavicon(url)**: Set a new favicon URL. + + Example: + ```javascript + cloak.setFavicon("new-icon-url.ico"); + ``` + +- **setCloak(newTitle, url)**: Set both the document title and favicon, and store them in localStorage. + + Example: + ```javascript + cloak.setCloak("New Cloak Title", "new-cloak-icon-url.ico"); + ``` + If you encounter any issues, feel free to create an issue on GitHub.