Move functions to improve logical ordering of docs

This commit is contained in:
Lovell Fuller
2020-01-03 20:58:57 +00:00
parent 84c20373ec
commit 96a994a4c0
9 changed files with 176 additions and 175 deletions

View File

@@ -1,8 +1,31 @@
'use strict';
const events = require('events');
const is = require('./is');
const sharp = require('../build/Release/sharp.node');
/**
* An Object containing nested boolean values representing the available input and output formats/methods.
* @member
* @example
* console.log(sharp.format);
* @returns {Object}
*/
const format = sharp.format();
/**
* An Object containing the version numbers of libvips and its dependencies.
* @member
* @example
* console.log(sharp.versions);
*/
let versions = {
vips: sharp.libvipsVersion()
};
try {
versions = require('../vendor/versions.json');
} catch (err) {}
/**
* Gets or, when options are provided, sets the limits of _libvips'_ operation cache.
* Existing entries in the cache will be trimmed after any change in limits.
@@ -61,6 +84,18 @@ function concurrency (concurrency) {
return sharp.concurrency(is.integer(concurrency) ? concurrency : null);
}
/**
* An EventEmitter that emits a `change` event when a task is either:
* - queued, waiting for _libuv_ to provide a worker thread
* - complete
* @member
* @example
* sharp.queue.on('change', function(queueLength) {
* console.log('Queue contains ' + queueLength + ' task(s)');
* });
*/
const queue = new events.EventEmitter();
/**
* Provides access to internal task counters.
* - queue is the number of tasks this module has queued waiting for _libuv_ to provide a worker thread from its pool.
@@ -110,4 +145,7 @@ module.exports = function (Sharp) {
].forEach(function (f) {
Sharp[f.name] = f;
});
Sharp.format = format;
Sharp.versions = versions;
Sharp.queue = queue;
};