A helper library for MouseHunt userscripts.
Current Version: 1.10.5
Add the following to your userscript in the header.
// @require https://cdn.jsdelivr.net/npm/[email protected]/mousehunt-utils.jsYour userscript should have a header like this:
// ==UserScript==
// @name My Userscript
// @description This is my userscript.
// @require https://cdn.jsdelivr.net/npm/[email protected]/mousehunt-utils.js
// @match https://www.mousehuntgame.com/*
// ==/UserScript==Once you've added the @require line, you can use the functions in the library with no extra setup!
onRequestDo something when a request is made.onAjaxRequestDo something when a request is made. Deprecated: UseonRequestinstead.onEventDo something when an event is triggered.onPageChangeDo something when the page changes.onDialogShowDo something when a popup or overlay shows.onDialogHideDo something when a popup or overlay hides.onOverlayChangeDo something when a popup or overlay changes. Deprecated: UseonDialogShowandonDialogHideinstead.onTrapChangeDo something when a trap component changes, such as the charm or cheese.onTravelDo something when the user travels to a new location.
doRequestMake a request to a MouseHunt endpoint.
getCurrentLocationGet the current location.getCurrentPageGet the current page.getCurrentTabGet the current tab.getCurrentSubtabGet the current subtab.isOverlayVisibleCheck if a popup or overlay is visible.getCurrentOverlayGet the current popup or overlay.isDarkModeCheck if the user is using dark mode.isLoggedInCheck if the user is logged in.isLegacyHUDCheck if the user is using the legacy HUD.userHasItemCheck if the user has an item.getUserItemsGet the details of an array of items.getUserSetupDetailsGet the details of the user's setup.
createPopupCreate a basic popup.createChoicePopupCreate a popup with two choices.createImagePopupCreate a popup with an image, similar to the mouse image popup.createLarryPopupCreate a popup with the Larry Office background.createPaperPopupCreate a popup with a paper background.createMapPopupCreate a popup inside the treasure map popup.createWelcomePopupCreate a popup that shows once.showHornMessageShow a message in the horn popup.
addSettingAdd a setting to the Game Settings page.addSettingsTabAdd a tab to the Game Settings page.getSettingGet the value of a setting.saveSettingSave a setting.createFavoriteButtonCreate a favorite button.
addStylesAdd CSS styles to the page.addSubmenuItemAdd a submenu item to the menu.addItemToGameInfoBarAdd an item to the Game Info Bar.makeButtonCreate a button.makeElementCreate an element.makeElementDraggableMake an element draggable, automatically saving and restoring the position.waitWait for a number of milliseconds.
clogLog a message to the console.debugLog a message to the console if debugging is enabled.enableDebugModeEnable debugging.
Do something when a request is made, either on every request or on a specific endpoint.
| Name | Type | Required | Description |
|---|---|---|---|
callback |
function |
Yes | The function to call when the request is made. |
url |
string |
No | The URL to call the function on. If not specified, the function will be called on every request. |
skipSuccess |
boolean |
No | If true, the function will not be called on successful requests. |
onRequest(() => {
// Do something when the userInventory endpoint is called.
}, 'managers/ajax/users/userInventory.php');
// Doing something on all requests.
onRequest((req) => { console.log(req) })Do something when a request is made, either on every request or on a specific endpoint. Deprecated: Use onRequest instead.
| Name | Type | Required | Description |
|---|---|---|---|
callback |
function |
Yes | The function to call when the request is made. |
url |
string |
No | The URL to call the function on. If not specified, the function will be called on every request. |
skipSuccess |
boolean |
No | If true, the function will not be called on successful requests. |
onAjaxRequest(() => {
// Do something when the userInventory endpoint is called.
}, 'managers/ajax/users/userInventory.php');
// Doing something on all requests.
onAjaxRequest((req) => { console.log(req) })Do something when an event is triggered - a wrapper around the HG event registry.
| Name | Type | Required | Description |
|---|---|---|---|
event |
string |
Yes | The name of the event to listen for. |
callback |
function |
Yes | The function to call when the event is triggered. |
onEvent('travel_complete', () => {
// Do something when the user travels.
});onEvent('ajax_response', () => {
console.log('Fired when an ajax request is made.');
});Do something when the page changes, either on any page or when leaving or entering a specific page.
All parameters are optional, but you probably want to specify at least one of change, show, or hide.
| Name | Type | Required | Description |
|---|---|---|---|
options |
object |
Yes | The options for the trigger. |
options.change |
function |
No | The function to call when the page changes. |
options.<page> |
object |
No | The options for a specific page. |
options.<page>.show |
function |
No | The function to call when a specifc page is shown. |
options.<page>.hide |
function |
No | The function to call when a specifc page is hidden. |
Any of these can be used as the <page> parameter.
camptravelinventoryshopmicefriendssendSuppliesteamtournamentnewsscoreboardsdiscord
onPageChange({
change: () => { console.log('Current page: ' + getCurrentPage()); },
travel: {
show: () => { console.log('travel is visible'); },
hide: () => { console.log('travel is hidden'); }
},
});Do something when a popup / overlay shows, either on any popup or when a specific popup is shown.
| Name | Type | Required | Description |
|---|---|---|---|
callback |
function |
Yes | The function to call when the popup is shown. |
overlay |
string |
No | The popup to listen for. |
once |
boolean |
No | Whether to only call the callback once. |
Any of these can be used as the <overlay> parameter, as well as passing in any other overlay name.
mapitemmouseimageconvertibleadventureBookmarketplacegiftssupportpremiumShop
onDialogShow(() => {
console.log('Opened map popup');
}, 'map');Do something when a popup / overlay hides, either on any popup or when a specific popup is hidden.
| Name | Type | Required | Description |
|---|---|---|---|
callback |
function |
Yes | The function to call when the popup is hidden. |
overlay |
string |
No | The popup to listen for. |
once |
boolean |
No | Whether to only call the callback once. |
Any of these can be used as the <overlay> parameter, as well as passing in any other overlay name.
mapitemmouseimageconvertibleadventureBookmarketplacegiftssupportpremiumShop
onDialogHide(() => {
console.log('Closed map popup');
}, 'map');Deprecated: Use onDialogShow and onDialogHide instead.
Do something when a popup / overlay changes, either on any popup or when a specific popup is shown or hidden.
All parameters are optional, but you probably want to specify at least one of change, show, or hide.
| Name | Type | Required | Description |
|---|---|---|---|
options |
object |
Yes | The options for the trigger. |
options.change |
function |
No | The function to call when the page changes. |
options.<overlay> |
object |
No | The options for a specific overlay. |
options.<overlay>.show |
function |
No | The function to call when a specifc overlay is shown. |
options.<overlay>.hide |
function |
No | The function to call when a specifc overlay is hidden. |
Any of these can be used as the <overlay> parameter.
mapitemmouseimageconvertibleadventureBookmarketplacegiftssupportpremiumShop
onOverlayChange({
change: () => { console.log('overlayPopup changed'); },
show: () => { console.log('overlayPopup is visible'); },
hide: () => { console.log('overlayPopup is hidden'); },
map: {
show: () => { console.log('treasureMapPopup is visible'); },
hide: () => { console.log('treasureMapPopup is hidden'); },
},
});Do something when a trap component changes, such as the charm or cheese.
All parameters are optional, but you probably want to specify at least one of change, show, or hide.
| Name | Type | Required | Description |
|---|---|---|---|
options |
object |
Yes | The options for the trigger. |
options.change |
function |
No | The function to call when the trap changes. |
options.show |
function |
No | The function to call when the trap is shown. |
options.hide |
function |
No | The function to call when the trap is hidden. |
options.<component> |
object |
No | The options for a specific component. |
options.<component>.change |
function |
No | The function to call when a specifc component changes. |
options.<component>.show |
function |
No | The function to call when a specifc component is shown. |
options.<component>.hide |
function |
No | The function to call when a specifc component is hidden. |
baitbaseweaponcharmskin
onTrapChange({
change: () => { console.log('trap changed'); },
show: () => { console.log('trap is visible'); },
hide: () => { console.log('trap is hidden'); },
bait: {
show: () => { console.log('bait is visible'); },
hide: () => { console.log('bait is hidden'); }
},
});Do something when the user travels to a new location.
| Name | Type | Required | Description |
|---|---|---|---|
location |
string |
Yes | The location to travel to. |
options |
object |
No | The options for the trigger. |
options.shouldAddReminder |
boolean |
No | Whether to add a reminder for the location. |
options.title |
string |
No | The title of the reminder. |
options.text |
string |
No | The text of the reminder. |
options.button |
string |
No | The text of the button on the reminder. |
options.action |
function |
No | The function to call when the button is clicked. |
options.callback |
function |
No | The function to call when the travel is complete. |
onTravel('table_of_contents', {
shouldAddReminder: true,
title: 'Make sure you enable CC!',
text: 'If you don\'t enable CC, your writing will be slower.',
button: 'Dismiss',
});onTravel('rift_valour', {
shouldAddReminder: true,
title: 'Valour Rift'
text: 'You should go to Floating Islands instead.',
button: 'Travel',
action: () => { app.pages.TravelPage.travel('floating_islands'); },
});Make a request to a MouseHunt endpoint.
| Name | Type | Required | Description |
|---|---|---|---|
url |
string |
Yes | The URL to make the request to. |
data |
object |
No | The data to send with the request. |
doRequest(
'managers/ajax/pages/page.php',
{
page_class: 'HunterProfile',
'page_arguments[tab]': 'mice',
'page_arguments[sub_tab]': 'location',
}
).then((data) => {
// Do something with the data.
});const itemData = await doRequest('managers/ajax/users/userInventory.php', {
action: 'get_items',
'item_types[]': 'cheddar_cheese'
});
console.log(itemData); // { cheddar_cheese: { ... } }Returns the current location.
Returns the current page.
Returns the current tab.
Returns the current subtab, falling back to the current tab if there is no subtab.
Returns whether there is currently a popup / overlay visible.
Returns the current visible popup / overlay.
Returns whether the user is using dark mode, either via the extension or MHCT dark mode option.
Returns whether the user is logged in.
Returns whether the user is using the legacy HUD.
Returns whether the user has a specific item.
userHasItem(itemType);| Name | Type | Required | Description |
|---|---|---|---|
itemType |
string |
Yes | The type of item to check for. |
if (! userHasItem('super_brie_cheese')) {
console.log("Oh no! You're out of SB!");
}Get the data for an array of items.
| Name | Type | Required | Description |
|---|---|---|---|
itemTypes |
array |
Yes | The types of items to get data for. |
const items = await getUserItems(['super_brie_cheese']);
console.log(items); // { super_brie_cheese: { ... } }Gets the details of the user's setup, including the current power, luck, etc from each component and aura.
getUserSetupDetails()Example return value
{
"type": "Arcane",
"stats": {
"power": 6963,
"powerBonus": 0.51,
"luck": 58,
"attractionBonus": 0.26,
"cheeseEfect": "No Effect"
},
"bait": {
"id": 3188,
"name": "Speedy Coggy Colby",
"quantity": 454,
"power": 0,
"powerBonus": 0,
"luck": 0,
"attractionBonus": 0
},
"base": {
"id": 3364,
"name": "Seasonal Gift of the Day Base",
"power": 100,
"powerBonus": 0,
"luck": 10,
"attractionBonus": 0.15
},
"charm": {
"id": 2780,
"name": "Factory Repair Charm",
"quantity": 872,
"power": 11,
"powerBonus": 11,
"luck": 5,
"attractionBonus": 0.11
},
"weapon": {
"id": 3304,
"name": "Boiling Cauldron Trap",
"power": 4500,
"powerBonus": 15,
"luck": 20,
"attractionBonus": 0
},
"aura": {
"lgs": {
"active": true,
"power": 0,
"powerBonus": 0,
"luck": 7,
"type": "lgs"
},
"lightning": {
"active": true,
"power": 0,
"powerBonus": 0.25,
"luck": 0,
"type": "lightning"
},
"chrome": {
"active": true,
"power": 0,
"powerBonus": 0,
"luck": 5,
"type": "chrome"
},
"slayer": {
"active": true,
"power": 0,
"powerBonus": 0,
"luck": 5,
"type": "slayer"
},
"festive": {
"active": true,
"power": 0,
"powerBonus": 0,
"luck": 5,
"type": "festive"
},
"luckycodex": {
"active": true,
"power": 0,
"powerBonus": 0,
"luck": 1,
"type": "luckycodex"
},
"riftstalker": {
"active": false,
"power": 0,
"powerBonus": 0,
"luck": 0
}
},
"location": {
"name": "SUPER|brie+ Factory",
"id": 60,
"slug": "super_brie_factory"
},
"cheeseEffect": "No Effect"
}
Creates a popup with the given title and content. Make sure to add an event listener to the target element to show the popup.
| Name | Type | Required | Description |
|---|---|---|---|
options |
object |
Yes | The options for the popup. |
options.title |
string |
No | The title of the popup. |
options.content |
string |
No | The content of the popup. |
options.hasCloseButton |
boolean |
No | Whether the popup should have a close button. |
options.template |
string |
No | The template to use for the popup. |
options.show |
boolean |
No | Whether the popup should be shown immediately. |
options.className |
string |
No | The class name to add to the popup. |
const examplePopupTarget = document.querySelector('.mousehuntHud-gameInfo');
if (examplePopupTarget) {
examplePopupTarget.addEventListener('click', () => {
createPopup({
title: 'Example Popup',
content: 'This is an example popup.',
});
});
}Creates a popup with two choices.
| Name | Type | Required | Description |
|---|---|---|---|
options |
object |
Yes | The options for the popup. |
options.title |
string |
No | The title of the popup. |
options.choices |
array |
Yes | The choices for the popup. |
options.choices.id |
string |
Yes | The id of the choice. |
options.choices.name |
string |
Yes | The name of the choice. |
options.choices.image |
string |
Yes | The image of the choice. |
options.choices.meta |
string |
Yes | The subheading of the choice. |
options.choices.text |
string |
Yes | The text of the choice. |
options.choices.button |
string |
Yes | The text of the button. |
options.choices.action |
function |
Yes | The callback function for the choice. |
createChoicePopup({
title: 'Choose your favorite Mouse',
choices: [
{
id: 'treasurer_mouse',
name: 'Treasurer',
image: 'https://www.mousehuntgame.com/images/mice/medium/bb55034f6691eb5e3423927e507b5ec9.jpg?cv=2',
meta: 'Mouse',
text: 'This is a mouse',
button: 'Select',
callback: () => {
console.log('treasurer selected');
}
},
{
id: 'high_roller_mouse',
name: 'High Roller',
image: 'https://www.mousehuntgame.com/images/mice/medium/3f71c32f9d8da2b2727fc8fd288f7974.jpg?cv=2',
meta: 'Mouse',
text: 'This is a mouse',
button: 'Select',
callback: () => {
console.log('high roller selected');
}
},
],
});Creates a popup with the given title and content.
| Name | Type | Description |
|---|---|---|
options |
object |
Yes |
options.title |
string |
No |
options.image |
string |
No |
options.show |
boolean |
No |
const exampleImagePopupTarget = document.querySelector('.mousehuntHud-userStat-row.points');
if (exampleImagePopupTarget) {
exampleImagePopupTarget.addEventListener('click', () => {
createImagePopup({
title: 'Example Image Popup',
image: 'https://example.com/example.png',
});
});
}Create a popup with the Larry's office style.
| Name | Type | Description |
|---|---|---|
content |
string |
Yes |
const exampleLarryPopupTarget = document.querySelector('.mousehuntHud-userStat-row.gold');
if (exampleLarryPopupTarget) {
exampleLarryPopupTarget.addEventListener('click', () => {
createLarryPopup('This is an example Larry popup.');
});
}Create a popup with the paper style.
| Name | Type | Description |
|---|---|---|
options |
object |
Yes |
options.title |
string |
No |
options.content |
object |
No |
options.content.title |
string |
No |
options.content.text |
string |
No |
options.content.image |
string |
No |
options.content.button |
object |
No |
options.content.button.text |
string |
No |
options.content.button.href |
string |
No |
options.show |
boolean |
No |
const examplePaperPopupTarget = document.querySelector('.mousehuntHud-userStat-row.gold');
if (examplePaperPopupTarget) {
examplePaperPopupTarget.addEventListener('click', () => {
createPaperPopup({
title: 'Example Paper Popup',
content: {
title: 'Example Paper Popup',
text: 'This is an example paper popup.',
image: 'https://example.com/example.png',
button: {
text: 'Example Button',
href: 'https://example.com',
},
},
});
});
}Creates a popup that shows while in the map popup.
| Name | Type | Description |
|---|---|---|
options |
object |
Yes |
options.title |
string |
No |
options.content |
string |
No |
options.closeClass |
string |
No |
options.closeText |
string |
No |
options.show |
boolean |
No |
const exampleMapPopupTarget = document.querySelector('.mousehuntHud-userStat-row.gold');
if (exampleMapPopupTarget) {
exampleMapPopupTarget.addEventListener('click', () => {
createMapPopup({
title: 'Example Map Popup',
content: 'This is an example map popup.',
});
});
}Creates a popup that shows once.
| Name | Type | Description |
|---|---|---|
options |
object |
Yes |
options.id |
string |
Yes |
options.title |
string |
No |
options.content |
string |
No |
options.columns |
array |
No |
options.columns.title |
string |
No |
options.columns.content |
string |
No |
const exampleWelcomePopupTarget = document.querySelector('.mousehuntHud-userStat-row.gold');
if (exampleWelcomePopupTarget) {
exampleWelcomePopupTarget.addEventListener('click', () => {
createWelcomePopup({
id: 'example-welcome-popup',
title: 'Example Welcome Popup',
content: 'This is an example welcome popup.',
columns: [
{
title: 'Example Column 1',
content: 'This is an example column 1.',
},
{
title: 'Example Column 2',
content: 'This is an example column 2.',
},
],
});
});
}Show a message in the horn popup.
| Name | Type | Required | Description |
|---|---|---|---|
options |
object |
Yes | The options for the message. |
options.title |
string |
No | The title of the message. |
options.text |
string |
No | The text of the message. |
options.button |
object |
No | The button text for the message. |
options.action |
function |
No | The action to perform when the button is clicked. |
showHornMessage({
title: 'Example Message',
text: 'This is an example message.',
button: 'Example Button',
action: () => {
console.log('Example action');
},
});Adds a boolean setting to the Game Settings page under 'Userscript Settings'.
| Name | Type | Required | Description |
|---|---|---|---|
name |
string |
Yes | The name of the setting. |
key |
string |
Yes | The key of the setting. |
defaultValue |
boolean |
No | The default value of the setting, defaults to true if not provided. |
description |
string |
No | The description of the setting. |
section |
object |
No | The section to add the setting to. |
section.id |
string |
No | The ID of the section to add the setting to. |
section.name |
string |
No | The name of the section to add the setting to. |
tab |
string |
No | The tab to add the setting to. Must be added with addSettingTab() first. |
addSetting('Enable Turbo Mode', 'turbo-mode-enabled', true, 'Enables turbo mode.');addSetting(
'My Setting',
'my-fancy-setting-key',
false,
'This is my fancy setting that even has a special section.',
{
id: 'my-fancy-section',
name: 'My Fancy Section',
}
);
addSetting(
'My Other Setting',
'my-other-fancy-setting-key',
false,
'This is my other fancy setting that goes in the same section.',
{
id: 'my-fancy-section',
name: 'My Fancy Section',
}
);Adds a tab to the Game Settings page to show a custom settings page.
| Name | Type | Required | Description |
|---|---|---|---|
identifier |
string |
Yes | The identifier of the tab. |
name |
string |
Yes | The name of the tab. |
addSettingsTab('my-tab', 'My Tab');const settingSection = {
id: 'my-section',
name: 'My fancy section',
};
const tab = addSettingsTab('my-tab', 'My Fancy Tab');
addSetting(
'This is my fancy setting',
'my-fancy-setting-key',
false,
'This is my fancy setting that goes in the fancy section.',
settingSection,
tab
);Gets the value of a setting.
const mySetting = getSetting('setting_key');
if (mySetting) {
// Do something.
} else {
// Do something else.
}Saves a setting.
| Name | Type | Required | Description |
|---|---|---|---|
key |
string |
Yes | The key of the setting. |
value |
boolean |
Yes | The value of the setting. |
identifier |
string |
No | The identifier of the setting group. |
saveSetting('setting_key', true);Creates a favorite button that can be toggled on and off.
| Name | Type | Required | Description |
|---|---|---|---|
options |
object |
Yes | The options for the favorite button. |
options.id |
string |
Yes | The ID of the favorite button. |
options.target |
Node |
Yes | The element to append the favorite button to. |
options.size |
string |
No | The size of the favorite button, defaults to small. |
options.defaultState |
boolean |
No | The default state of the favorite button, defaults to false. |
const infobar = document.querySelector('.mousehuntHud-gameInfo');
createFavoriteButton({
id: 'testing_favorite',
target: infobar,
size: 'small',
defaultState: false,
});Add CSS styles to the page.
| Name | Type | Required | Description |
|---|---|---|---|
styles |
string |
Yes | The CSS styles to add. |
id |
string |
No | The ID of the style element. |
displayOnce |
boolean |
No | If enabled, the styles will only be added if that id has not been used before. |
addStyles(`
.my-class {
color: red;
}
.huntersHornView {
display: none;
}
`);Add a submenu item to the menu.
| Name | Type | Required | Description |
|---|---|---|---|
options |
object |
Yes | The options for the submenu item. |
options.menu |
string |
No | The menu to add the submenu item to, defaults to Kingdom. |
options.label |
string |
No | The label of the submenu item. |
options.icon |
string |
No | The icon of the submenu item, defaults to the stars icon. |
options.href |
string |
No | The link for the submenu item. |
options.class |
string |
No | The class of the submenu item. |
options.callback |
function |
No | The callback function to run when the submenu item is clicked. |
options.external |
boolean |
No | Whether the submenu item should show the external link icon, defaults to false. |
addSubmenuItem({
menu: 'kingdom',
label: 'mouse.rip',
icon: 'https://www.mousehuntgame.com/images/ui/hud/menu/prize_shoppe.png',
href: 'https://mouse.rip',
external: true,
});Adds a link to the top 'Hunters Online' bar.
| Name | Type | Required | Description |
|---|---|---|---|
options |
object |
Yes | The options for the submenu item. |
options.label |
string |
No | The label of the submenu item. |
options.icon |
string |
No | The icon of the submenu item, defaults to the stars icon. |
options.href |
string |
No | The link for the submenu item. |
options.class |
string |
No | The class of the submenu item. |
options.callback |
function |
No | The callback function to run when the submenu item is clicked. |
options.external |
boolean |
No | Whether the submenu item should show the external link icon, defaults to false. |
addItemToGameInfoBar({
label: 'mouse.rip',
icon: 'https://www.mousehuntgame.com/images/ui/hud/menu/prize_shoppe.png',
href: 'https://mouse.rip',
external: true,
});addItemToGameInfoBar({
label: 'Spring Egg Hunt Helper',
icon: 'https://www.mousehuntgame.com/images/items/convertibles/transparent_thumb/887162c61d0e01985ffc12e41c03d952.png?cv=2',
class: 'mh-egg-helper-top-menu',
callback: bookPopup
});Create an element with a given class and text, optionally appending it to another element.
| Name | Type | Required | Description |
|---|---|---|---|
type |
string |
Yes | The type of element to create. |
className |
string |
No | The class name to add to the element. |
text |
string |
No | The text to add to the element. |
appendTo |
Node |
No | The element to append the new element to. |
const myElement = makeElement('div', 'my-class', 'My Text');makeElement('a', 'some-class', 'This is a link', document.body);Creates a button to match the button style.
| Name | Type | Required | Description |
|---|---|---|---|
text |
string |
Yes | The text of the button. |
href |
string |
Yes | The href of the button. |
tiny |
boolean |
No | Whether the button should be tiny. |
extraClasses |
array |
No | Any extra classes to add to the button. |
const myButton = makeButton('My Button', 'https://example.com');Make an element draggable, with the ability to automatical saving and restoring the position.
| Name | Type | Required | Description |
|---|---|---|---|
dragTarget |
string |
Yes | The selector for the element to make draggable. |
dragHandle |
string |
Yes | The selector for the element to use as the drag handle. |
defaultX |
number |
No | The default X position of the element, defaults to 0. |
defaultY |
number |
No | The default Y position of the element, defaults to 0. |
storageKey |
string |
No | The key to use for storing the position in localStorage, defaults to dragTarget. |
savePosition |
boolean |
No | Whether the position should be saved in localStorage, defaults to true. |
makeElementDraggable(
'#mh-catch-stats',
'.mh-catch-stats-header',
25,
25,
'mh-catch-stats-position'
true
);Wait for a number of seconds before resolving a promise.
| Name | Type | Required | Description |
|---|---|---|---|
ms |
number |
Yes | The number of milliseconds to wait. |
wait(1000).then(() => {
console.log('1 second has passed');
});Log a message to the console.
| Name | Type | Required | Description |
|---|---|---|---|
message |
`string | object` | Yes |
clog('Hello World');clog('hello', 'world');Log a message to the console if debugging is enabled.
| Name | Type | Required | Description |
|---|---|---|---|
message |
`string | object` | Yes |
const myVar = getSomeVar();
debug(myVar);Adds an option in the preferences to enable debugging, must be called before using debug.