Skip to content

Commit

Permalink
point to @webxdc/types and use @webxdc/vite-plugins for emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Nov 27, 2024
1 parent d648feb commit d7d3831
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 510 deletions.
31 changes: 11 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ Sample project with a simple implementation of the webxdc read and write APIs.

## Developing webxdc apps

Simply copy `webxdc.js` from this repo beside your `index.html` and you are ready to go
to **develop and test your app in most browsers.**
Include:
```html
<script src="https://cdn.jsdelivr.net/gh/webxdc/vite-plugins@latest/src/webxdc.js"></script>
```
in your `index.html` to use a webxdc emulator and you are ready to
**develop and test your app in most browsers.**

Bundle your app using `./create-xdc.sh your-app-name`
and **send it to your friends** 🙂
Expand All @@ -23,6 +27,11 @@ and **send it to your friends** 🙂

## Further Hints and Troubleshooting

### Type-checking

If you want to have type-checking you can use [@webxdc/types](https://github.com/webxdc/webxdc-types/) package, check:

https://github.com/webxdc/webxdc-types/

### Limitations

Expand All @@ -34,24 +43,6 @@ bundle the app and test it in Delta Chat directly
where all peers get their own `localStorage`.
Alternatively, use the more advanced [webxdc-dev](https://github.com/webxdc/webxdc-dev) tool.


### Type-checking and completion

If you are using VSCode you can have autocompletion and type-checking even without using TypeScript by adding these two lines to your JavaScript source files:

```js
//@ts-check
/** @typedef {import('./webxdc').Webxdc} Webxdc */
```

Without VSCode you need to install TypeScript and then run the check manually.

```sh
npm -g typescript
tsc --noEmit --allowJs --lib es2016,dom webxdc.js # to check if types and simulator are in sync
tsc --noEmit --allowJs --lib es2016,dom your_js_file.js
```

### Developing in Safari

To use the devtool in safari you need to disable the local file restrictions
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<title>Hello</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width"/>
<script src="https://cdn.jsdelivr.net/gh/webxdc/vite-plugins@latest/src/webxdc.js"></script>
<script src="webxdc.js"></script>
<style type="text/css">
body {
Expand Down
166 changes: 0 additions & 166 deletions webxdc.d.ts

This file was deleted.

Loading

0 comments on commit d7d3831

Please sign in to comment.