Contributing in client-side features
To contribute to the emulators-ui
package do the following:
Checkout
emulators-ui
repositorygit clone https://github.com/js-dos/emulators-ui
Install gulp 4
Now you can build everything with
gulp
command
#
Adding new client-side featuresjs-dos has an optional config file that you can put in js-dos bundle
. This
file should be in json format. It can contain any information you want and it accessible from Command Interface:
const ci = await Dos(/*element*/).run(/*bundle url*/);
const config = await ci.config();
Let's understand how layers are implemented in js-dos.
First, layers have special configuration that stored in jsdos.json
file, it's looks
like:
{
// ...
"layers": [
{
"grid": "honeycomb",
"title": "Layer#0",
"controls": [
{
"row": 0,
//...
When js-dos starting it waits until config file is read and configure gestures layer according to its configuration.
async run(bundleUrl: string): Promise<CommandInterface> {
const bundle = await emulatorsUi.network.resolveBundle(bundleUrl);
this.ciPromise = emulators.dosWorker(bundle);
const ci = await this.ciPromise;
const config = await ci.config();
// ...
// (config as any).layers
// ...
}
You can do in same way:
- You can add some information to config file
- You can access it in your client code
Doing this does not require changing the native part of js-dos
.