### Table of Contents - [constructor](#constructor) - [getLock](#getlock) - [update](#update) - [getInstance](#getinstance) - [done](#done) - [wait](#wait) - [leastNumberOfTicks](#leastnumberofticks) ## constructor [scheduler.js:8-13](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/scheduler.js#L8-L13 "Source code on GitHub") The Sceduler manages the run cycle of the containes and figures out which order they should run in ## getLock [scheduler.js:20-30](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/scheduler.js#L20-L30 "Source code on GitHub") locks the scheduler from clearing waits untill the lock is resolved **Parameters** - `id` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returns **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** the resolve function to call once it to unlock ## update [scheduler.js:36-40](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/scheduler.js#L36-L40 "Source code on GitHub") updates an instance with a new tick count **Parameters** - `instance` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** a container instance ## getInstance [scheduler.js:59-61](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/scheduler.js#L59-L61 "Source code on GitHub") returns a container **Parameters** - `id` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** ## done [scheduler.js:67-71](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/scheduler.js#L67-L71 "Source code on GitHub") deletes an instance from the scheduler **Parameters** - `id` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the containers id ## wait [scheduler.js:80-94](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/scheduler.js#L80-L94 "Source code on GitHub") returns a promise that resolves once all containers have reached the given number of ticks **Parameters** - `ticks` **interger** the number of ticks to wait (optional, default `Infinity`) - `id` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** optional id of the container that is waiting Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** ## leastNumberOfTicks [scheduler.js:100-103](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/scheduler.js#L100-L103 "Source code on GitHub") returns the oldest container's ticks Returns **integer**