Documentation fixes & consistency improvements (#1378)
* Fix incorrect docs * Adjust wording & formatting for consistency * Fix missing "is"
This commit is contained in:
parent
7e8c114f65
commit
9b38e442da
|
@ -135,13 +135,13 @@ BdApi.showConfirmationModal = function (title, content, options = {}) {
|
|||
};
|
||||
|
||||
/**
|
||||
* This shows a toast similar to android towards the bottom of the screen.
|
||||
* Shows a toast similar to android towards the bottom of the screen.
|
||||
*
|
||||
* @param {string} content The string to show in the toast.
|
||||
* @param {object} options Options object. Optional parameter.
|
||||
* @param {string} [options.type=""] Changes the type of the toast stylistically and semantically. Choices: "", "info", "success", "danger"/"error", "warning"/"warn". Default: ""
|
||||
* @param {boolean} [options.icon=true] Determines whether the icon should show corresponding to the type. A toast without type will always have no icon. Default: true
|
||||
* @param {number} [options.timeout=3000] Adjusts the time (in ms) the toast should be shown for before disappearing automatically. Default: 3000
|
||||
* @param {boolean} [options.icon=true] Determines whether the icon should show corresponding to the type. A toast without type will always have no icon. Default: `true`
|
||||
* @param {number} [options.timeout=3000] Adjusts the time (in ms) the toast should be shown for before disappearing automatically. Default: `3000`
|
||||
* @param {boolean} [options.forceShow=false] Whether to force showing the toast and ignore the bd setting
|
||||
*/
|
||||
BdApi.showToast = function(content, options = {}) {
|
||||
|
@ -149,24 +149,24 @@ BdApi.showToast = function(content, options = {}) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Show a notice above discord's chat layer.
|
||||
* Shows a notice above Discord's chat layer.
|
||||
*
|
||||
* @param {string|Node} content Content of the notice
|
||||
* @param {object} options Options for the notice.
|
||||
* @param {string} [options.type="info" | "error" | "warning" | "success"] Type for the notice. Will affect the color.
|
||||
* @param {Array<{label: string, onClick: function}>} [options.buttons] Buttons that should be added next to the notice text.
|
||||
* @param {number} [options.timeout=10000] Timeout until the notice is closed. Won't fire if it's set to 0;
|
||||
* @returns {function}
|
||||
* @returns {function} A callback for closing the notice. Passing `true` as first parameter closes immediately without transitioning out.
|
||||
*/
|
||||
BdApi.showNotice = function (content, options = {}) {
|
||||
return Notices.show(content, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Finds a webpack module using a filter
|
||||
* Finds a webpack module using a filter.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {function} filter A filter given the exports, module, and moduleId. Returns true if the module matches.
|
||||
* @param {function} filter A filter given the exports, module, and moduleId. Returns `true` if the module matches.
|
||||
* @returns {any} Either the matching module or `undefined`
|
||||
*/
|
||||
BdApi.findModule = function(filter) {
|
||||
|
@ -174,10 +174,10 @@ BdApi.findModule = function(filter) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Finds multple webpack modules using a filter
|
||||
* Finds multiple webpack modules using a filter.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {function} filter A filter given the exports, module, and moduleId. Returns true if the module matches.
|
||||
* @param {function} filter A filter given the exports, module, and moduleId. Returns `true` if the module matches.
|
||||
* @returns {Array} Either an array of matching modules or an empty array
|
||||
*/
|
||||
BdApi.findAllModules = function(filter) {
|
||||
|
@ -185,7 +185,7 @@ BdApi.findAllModules = function(filter) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Finds a webpack module by own properties
|
||||
* Finds a webpack module by own properties.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {...string} props Any desired properties
|
||||
|
@ -197,7 +197,7 @@ BdApi.findModuleByProps = function(...props) {
|
|||
|
||||
|
||||
/**
|
||||
* Finds a webpack module by own prototypes
|
||||
* Finds a webpack module by own prototypes.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {...string} protos Any desired prototype properties
|
||||
|
@ -208,10 +208,10 @@ BdApi.findModuleByPrototypes = function(...protos) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Finds a webpack module by displayName property
|
||||
* Finds a webpack module by `displayName` property.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {string} name Desired displayName property
|
||||
* @param {string} name Desired `displayName` property
|
||||
* @returns {any} Either the matching module or `undefined`
|
||||
*/
|
||||
BdApi.findModuleByDisplayName = function(name) {
|
||||
|
@ -219,7 +219,7 @@ BdApi.findModuleByDisplayName = function(name) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Get the internal react data of a specified node
|
||||
* Gets the internal react data of a specified node.
|
||||
*
|
||||
* @param {HTMLElement} node Node to get the react data from
|
||||
* @returns {object|undefined} Either the found data or `undefined`
|
||||
|
@ -268,7 +268,7 @@ BdApi.deleteData = function(pluginName, key) {
|
|||
};
|
||||
|
||||
/**
|
||||
* This function monkey-patches a method on an object. The patching callback may be run before, after or instead of target method.
|
||||
* Monkey-patches a method on an object. The patching callback may be run before, after or instead of target method.
|
||||
*
|
||||
* - Be careful when monkey-patching. Think not only about original functionality of target method and your changes, but also about developers of other plugins, who may also patch this method before or after you. Try to change target method behaviour as little as possible, and avoid changing method signatures.
|
||||
* - Display name of patched method is changed, so you can see if a function has been patched (and how many times) while debugging or in the stack trace. Also, patched methods have property `__monkeyPatched` set to `true`, in case you want to check something programmatically.
|
||||
|
@ -343,7 +343,7 @@ BdApi.testJSON = function(data) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Gets a specific setting's status from BD
|
||||
* Gets a specific setting's status from BD.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {string} [collection="settings"] Collection ID
|
||||
|
@ -356,7 +356,7 @@ BdApi.isSettingEnabled = function(collection, category, id) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Enable a BetterDiscord setting by ids.
|
||||
* Enables a BetterDiscord setting by ids.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {string} [collection="settings"] Collection ID
|
||||
|
@ -380,7 +380,7 @@ BdApi.disableSetting = function(collection, category, id) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Toggle a BetterDiscord setting by ids.
|
||||
* Toggles a BetterDiscord setting by ids.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {string} [collection="settings"] Collection ID
|
||||
|
@ -395,7 +395,7 @@ BdApi.toggleSetting = function(collection, category, id) {
|
|||
* Gets some data in BetterDiscord's misc data.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {string} key Key of the data to load.
|
||||
* @param {string} key Key of the data to load
|
||||
* @returns {any} The stored data
|
||||
*/
|
||||
BdApi.getBDData = function(key) {
|
||||
|
@ -403,10 +403,10 @@ BdApi.getBDData = function(key) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Gets some data in BetterDiscord's misc data.
|
||||
* Sets some data in BetterDiscord's misc data.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {string} key Key of the data to load.
|
||||
* @param {string} key Key of the data to store
|
||||
* @returns {any} The stored data
|
||||
*/
|
||||
BdApi.setBDData = function(key, data) {
|
||||
|
@ -520,7 +520,7 @@ BdApi.Themes = new AddonAPI(ThemeManager);
|
|||
BdApi.Patcher = {
|
||||
/**
|
||||
* This method patches onto another function, allowing your code to run beforehand.
|
||||
* Using this, you are also able to modify the incoming arguments before the original method is run.
|
||||
* Using this, you are able to modify the incoming arguments before the original method is run.
|
||||
* @param {string} caller Name of the caller of the patch function.
|
||||
* @param {object} moduleToPatch Object with the function to be patched. Can also be an object's prototype.
|
||||
* @param {string} functionName Name of the function to be patched.
|
||||
|
@ -533,7 +533,7 @@ BdApi.Patcher = {
|
|||
|
||||
/**
|
||||
* This method patches onto another function, allowing your code to run instead.
|
||||
* Using this, you are also able to modify the return value, using the return of your code instead.
|
||||
* Using this, you are able to replace the original completely. You can still call the original manually if needed.
|
||||
* @param {string} caller Name of the caller of the patch function.
|
||||
* @param {object} moduleToPatch Object with the function to be patched. Can also be an object's prototype.
|
||||
* @param {string} functionName Name of the function to be patched.
|
||||
|
@ -545,8 +545,8 @@ BdApi.Patcher = {
|
|||
},
|
||||
|
||||
/**
|
||||
* This method patches onto another function, allowing your code to run instead.
|
||||
* Using this, you are also able to modify the return value, using the return of your code instead.
|
||||
* This method patches onto another function, allowing your code to run afterwards.
|
||||
* Using this, you are able to modify the return value after the original method is run.
|
||||
* @param {string} caller Name of the caller of the patch function.
|
||||
* @param {object} moduleToPatch Object with the function to be patched. Can also be an object's prototype.
|
||||
* @param {string} functionName Name of the function to be patched.
|
||||
|
@ -620,9 +620,9 @@ BdApi.Webpack = {
|
|||
byStrings(...strings) {return Filters.byStrings(strings);},
|
||||
|
||||
/**
|
||||
* Generates a function that filters by a set of properties.
|
||||
* Generates a function that filters by the `displayName` property.
|
||||
* @param {string} name Name the module should have
|
||||
* @returns {function} A filter that checks for a set of properties
|
||||
* @returns {function} A filter that checks for a `displayName` match
|
||||
*/
|
||||
byDisplayName(name) {return Filters.byDisplayName(name);},
|
||||
|
||||
|
@ -636,7 +636,7 @@ BdApi.Webpack = {
|
|||
|
||||
/**
|
||||
* Finds a module using a filter function.
|
||||
* @param {function} filter A function to use to filter modules. It is given exports, module, and moduleID. Return true to signify match.
|
||||
* @param {function} filter A function to use to filter modules. It is given exports, module, and moduleID. Return `true` to signify match.
|
||||
* @param {object} [options] Whether to return only the first matching module
|
||||
* @param {Boolean} [options.first=true] Whether to return only the first matching module
|
||||
* @param {Boolean} [options.defaultExport=true] Whether to return default export when matching the default export
|
||||
|
@ -660,8 +660,8 @@ BdApi.Webpack = {
|
|||
getBulk(...queries) {return WebpackModules.getBulk(...queries);},
|
||||
|
||||
/**
|
||||
* Finds a module that lazily loaded.
|
||||
* @param {function} filter A function to use to filter modules. It is given exports. Return true to signify match.
|
||||
* Finds a module that is lazily loaded.
|
||||
* @param {function} filter A function to use to filter modules. It is given exports. Return `true` to signify match.
|
||||
* @param {object} [options] Whether to return only the first matching module
|
||||
* @param {AbortSignal} [options.signal] AbortSignal of an AbortController to cancel the promise
|
||||
* @param {Boolean} [options.defaultExport=true] Whether to return default export when matching the default export
|
||||
|
|
Loading…
Reference in New Issue