jsnes/README.md

43 lines
1.4 KiB
Markdown
Raw Normal View History

2022-01-01 17:47:14 +00:00
# Webxdc Development Tool
2021-12-31 00:27:45 +00:00
2022-01-01 17:47:14 +00:00
this is a little tool to make development of webxdc apps easier.
2021-12-31 00:27:45 +00:00
2022-01-01 17:47:14 +00:00
for developing webxdc apps,
just copy the `webxdc.js` from this repo beside
2021-12-31 00:27:45 +00:00
your `index.html` and you are ready to go.
no server or installation required.
2022-01-01 17:47:14 +00:00
- include your `webxdc.js` to your `index.html` as usual
2021-12-31 00:27:45 +00:00
- open your `index.html` from your local disk in your browser,
2022-01-10 16:14:07 +00:00
(tested with Firefox and Chrome, for Safari, enable "Develop / Disable Local File Restrictions")
2021-12-31 00:27:45 +00:00
- the emulation layer will add an "add peer" button,
open as many peers as you like
- once you call sendUpdate() in on peer,
all peers will get the update with their update listeners.
2022-01-01 19:45:59 +00:00
when your app is done, you can bundle it using `./create-xdc.sh your-app-name`
and send it to your friends :)
2021-12-31 00:27:45 +00:00
note, that the api is not yet complete,
this is just a, maybe already useful, proof-of-concept for now.
2022-01-17 22:49:35 +00:00
## use type-checking and completion
If you are using vscode you can have autocompletion and type-checking even without using typescript.
just add these two lines to your javascript source files:
2022-01-17 22:49:35 +00:00
```js
//@ts-check
2022-01-29 19:11:20 +00:00
/** @typedef {import('./webxdc').Webxdc} Webxdc */
2022-01-17 22:49:35 +00:00
```
Without vscode you need to install typescript and then run the check manually.
2022-01-17 22:49:35 +00:00
```sh
npm -g typescript
tsc --noEmit --allowJs --lib es2015,dom webxdc.js # to check if types and simulator are in sync
tsc --noEmit --allowJs --lib es2015,dom your_js_file.js
```