docs: improve documentation
[poolifier.git] / docs / api.md
index fdba0f9d1077e408d730007c9be341f5b629be31..60a0a8be08194bc201b4d248d827ca1155a9bf72 100644 (file)
@@ -1,4 +1,19 @@
-## [API](https://poolifier.github.io/poolifier/)
+# [API](https://poolifier.github.io/poolifier/)
+
+## Table of contents
+
+- [Pool](#pool)
+  - [`pool = new FixedThreadPool/FixedClusterPool(numberOfThreads/numberOfWorkers, filePath, opts)`](#pool--new-fixedthreadpoolfixedclusterpoolnumberofthreadsnumberofworkers-filepath-opts)
+  - [`pool = new DynamicThreadPool/DynamicClusterPool(min, max, filePath, opts)`](#pool--new-dynamicthreadpooldynamicclusterpoolmin-max-filepath-opts)
+  - [`pool.execute(data, name)`](#poolexecutedata-name)
+  - [`pool.destroy()`](#pooldestroy)
+  - [`PoolOptions`](#pooloptions)
+    - [``ThreadPoolOptions extends PoolOptions`](#threadpooloptions-extends-pooloptions)
+    - [`ClusterPoolOptions extends PoolOptions`](#clusterpooloptions-extends-pooloptions)
+- [Worker](#worker)
+  - [`class YourWorker extends ThreadWorker/ClusterWorker`](#class-yourworker-extends-threadworkerclusterworker)
+
+## Pool
 
 ### `pool = new FixedThreadPool/FixedClusterPool(numberOfThreads/numberOfWorkers, filePath, opts)`
 
@@ -80,6 +95,8 @@ An object with these properties:
 
 - `settings` (optional) - An object with the cluster settings. See [cluster](https://nodejs.org/api/cluster.html#cluster_cluster_settings) for more details.
 
+## Worker
+
 ### `class YourWorker extends ThreadWorker/ClusterWorker`
 
 `taskFunctions` (mandatory) The task function or task functions object `{ name_1: fn_1, ..., name_n: fn_n }` that you want to execute on the worker