### Table of Contents - [constructor](#constructor) - [queue](#queue) - [message](#message) - [incrementTicks](#incrementticks) - [createMessage](#createmessage) - [createInstance](#createinstance) - [send](#send) ## constructor [kernel.js:16-31](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/kernel.js#L16-L31 "Source code on GitHub") the Kernel manages the varous message passing functions and provides an interface for the containers to use **Parameters** - `opts` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** - `opts.id` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the UUID of the Kernel - `opts.state` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the state of the container - `opts.hypervisor` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** - `opts.container` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the container constuctor and argments ## queue [kernel.js:38-41](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/kernel.js#L38-L41 "Source code on GitHub") adds a message to this containers message queue **Parameters** - `portName` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** - `message` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** ## message [kernel.js:89-115](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/kernel.js#L89-L115 "Source code on GitHub") run the kernels code with a given enviroment **Parameters** - `message` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the message to run - `method` (optional, default `'onMessage'`) - `init` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** whether or not to run the intialization routine Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** ## incrementTicks [kernel.js:132-135](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/kernel.js#L132-L135 "Source code on GitHub") updates the number of ticks that the container has run **Parameters** - `count` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the number of ticks to add ## createMessage [kernel.js:141-145](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/kernel.js#L141-L145 "Source code on GitHub") creates a new message **Parameters** - `opts` - `data` **any** ## createInstance [kernel.js:153-168](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/kernel.js#L153-L168 "Source code on GitHub") creates a new container. Returning a port to it. **Parameters** - `type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** - `message` - `data` **any** the data to populate the initail state with Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** ## send [kernel.js:175-184](https://github.com/primea/js-primea-hypervisor/blob/add087e94722a8b77695d21eca754a562d7e79f5/kernel.js#L175-L184 "Source code on GitHub") sends a message to a given port **Parameters** - `port` - `message` **Message** the message - `portRef` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the port