mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
docs: general cleanup and improvements (#6299)
Co-authored-by: DaStormer <40336269+DaStormer@users.noreply.github.com> Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
This commit is contained in:
@@ -100,7 +100,7 @@ class ShardClientUtil {
|
||||
* Fetches a client property value of each shard, or a given shard.
|
||||
* @param {string} prop Name of the client property to get, using periods for nesting
|
||||
* @param {number} [shard] Shard to fetch property from, all if undefined
|
||||
* @returns {Promise<*>|Promise<Array<*>>}
|
||||
* @returns {Promise<*|Array<*>>}
|
||||
* @example
|
||||
* client.shard.fetchClientValues('guilds.cache.size')
|
||||
* .then(results => console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`))
|
||||
@@ -130,7 +130,7 @@ class ShardClientUtil {
|
||||
* Evaluates a script or function on all shards, or a given shard, in the context of the {@link Client}s.
|
||||
* @param {Function} script JavaScript to run on each shard
|
||||
* @param {BroadcastEvalOptions} [options={}] The options for the broadcast
|
||||
* @returns {Promise<*>|Promise<Array<*>>} Results of the script execution
|
||||
* @returns {Promise<*|Array<*>>} Results of the script execution
|
||||
* @example
|
||||
* client.shard.broadcastEval(client => client.guilds.cache.size)
|
||||
* .then(results => console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`))
|
||||
|
||||
@@ -19,8 +19,9 @@ const Util = require('../util/Util');
|
||||
*/
|
||||
class ShardingManager extends EventEmitter {
|
||||
/**
|
||||
* The mode to spawn shards with for a {@link ShardingManager}. Either "process" to use child processes, or
|
||||
* "worker" to use [Worker threads](https://nodejs.org/api/worker_threads.html).
|
||||
* The mode to spawn shards with for a {@link ShardingManager}. Can be either one of:
|
||||
* * 'process' to use child processes
|
||||
* * 'worker' to use [Worker threads](https://nodejs.org/api/worker_threads.html)
|
||||
* @typedef {string} ShardingManagerMode
|
||||
*/
|
||||
|
||||
@@ -242,7 +243,7 @@ class ShardingManager extends EventEmitter {
|
||||
* Evaluates a script on all shards, or a given shard, in the context of the {@link Client}s.
|
||||
* @param {Function} script JavaScript to run on each shard
|
||||
* @param {BroadcastEvalOptions} [options={}] The options for the broadcast
|
||||
* @returns {Promise<*>|Promise<Array<*>>} Results of the script execution
|
||||
* @returns {Promise<*|Array<*>>} Results of the script execution
|
||||
*/
|
||||
broadcastEval(script, options = {}) {
|
||||
if (typeof script !== 'function') return Promise.reject(new TypeError('SHARDING_INVALID_EVAL_BROADCAST'));
|
||||
@@ -253,7 +254,7 @@ class ShardingManager extends EventEmitter {
|
||||
* Fetches a client property value of each shard, or a given shard.
|
||||
* @param {string} prop Name of the client property to get, using periods for nesting
|
||||
* @param {number} [shard] Shard to fetch property from, all if undefined
|
||||
* @returns {Promise<*>|Promise<Array<*>>}
|
||||
* @returns {Promise<*|Array<*>>}
|
||||
* @example
|
||||
* manager.fetchClientValues('guilds.cache.size')
|
||||
* .then(results => console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`))
|
||||
@@ -268,7 +269,7 @@ class ShardingManager extends EventEmitter {
|
||||
* @param {string} method Method name to run on each shard
|
||||
* @param {Array<*>} args Arguments to pass through to the method call
|
||||
* @param {number} [shard] Shard to run on, all if undefined
|
||||
* @returns {Promise<*>|Promise<Array<*>>} Results of the method execution
|
||||
* @returns {Promise<*|Array<*>>} Results of the method execution
|
||||
* @private
|
||||
*/
|
||||
_performOnShards(method, args, shard) {
|
||||
|
||||
Reference in New Issue
Block a user