Skip to content

Commit

Permalink
rename to avoid using 'playdate' in title
Browse files Browse the repository at this point in the history
  • Loading branch information
jaames committed Mar 1, 2022
1 parent cc16421 commit 8b734ce
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
22 changes: 11 additions & 11 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# playdate-usb
# pd-usb

JavaScript library for interacting with a [Panic Playdate](http:https://play.date/) console over USB, wherever [WebUSB](https://web.dev/usb/) is supported.

> ⚠️ This library is unofficial and is not affiliated with Panic. Details on the USB protocol were gleaned from reverse-engineering and packet sniffing.
## Features

- Get Playdate device stats such as its version info, serial, cpu stats, etc
Expand All @@ -18,18 +20,16 @@ JavaScript library for interacting with a [Panic Playdate](http:https://play.date/) co
## Installation

> ⚠️ TODO: this project isn't actually on NPM or Unpkg yet, that will happen on release!
### With NPM

```shell
npm install playdate-usb --save
npm install pd-usb --save
```

Then assuming you're using a module-compatible system (like Webpack, Rollup, etc):

```js
import { requestConnectPlaydate } from 'playdate-usb';
import { requestConnectPlaydate } from 'pd-usb';

async function connectToPlaydate() {
const playdate = await requestConnectPlaydate();
Expand All @@ -42,7 +42,7 @@ Using the module directly via Unpkg:

```html
<script type="module">
import { requestConnectPlaydate } from 'https://unpkg.com/playdate-usb?module';
import { requestConnectPlaydate } from 'https://unpkg.com/pd-usb?module';
async function connectToPlaydate() {
const playdate = await requestConnectPlaydate();
Expand All @@ -53,7 +53,7 @@ Using the module directly via Unpkg:
Using an external script reference

```html
<script src="https://unpkg.com/playdate-usb/dist/playdate-usb.min.js"></script>
<script src="https://unpkg.com/pd-usb/dist/pd-usb.min.js"></script>
<script>
async function connectToPlaydate() {
const playdate = await playdateUsb.requestConnectPlaydate();
Expand All @@ -76,7 +76,7 @@ WebUSB is also only supported in [Secure Contexts](https://developer.mozilla.org
You can use the `isUsbSupported()` method to check if the current environment supports WebUSB:

```js
import { isUsbSupported } from 'playdate-usb';
import { isUsbSupported } from 'pd-usb';

if (!isUsbSupported) {
alert('Sorry, your browser does not support USB, and cannot connect to a Playdate :(')
Expand All @@ -96,7 +96,7 @@ For security reasons, `requestConnectPlaydate()` can only be called with a user
Then call `requestConnectPlaydate()` in the button's `click` event callback function:

```js
import { requestConnectPlaydate } from 'playdate-usb';
import { requestConnectPlaydate } from 'pd-usb';

const button = document.getElementById('connectButton');

Expand Down Expand Up @@ -201,7 +201,7 @@ Capture a screenshot from the Playdate, and get the unpacked framebuffer. This w
const screenPixels = await device.getScreenIndexed();
```

If you want to draw the screen to a HTML5 canvas, check out the [screen example](https://github.com/jaames/playdate-usb/blob/main/examples/example-screen.html).
If you want to draw the screen to a HTML5 canvas, check out the [screen example](https://github.com/jaames/pd-usb/blob/main/examples/example-screen.html).

#### `sendBitmap`

Expand All @@ -227,7 +227,7 @@ const pixels = new Uint8Array(400 * 240);
await device.sendBitmapIndexed(pixels);
```

If you want to creating a bitmap using a HTML5 canvas, check out the [bitmap example](https://github.com/jaames/playdate-usb/blob/main/examples/example-bitmap.html).
If you want to creating a bitmap using a HTML5 canvas, check out the [bitmap example](https://github.com/jaames/pd-usb/blob/main/examples/example-bitmap.html).

#### `run`

Expand Down
14 changes: 7 additions & 7 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const isEsmoduleBuild = process.env.ES_MODULE || false;
const isProdBuild = build === 'production';

const banner = `/*!!
playdate-usb v${ version }
pd-usb v${ version }
JavaScript library for interacting with a Panic Playdate console over USB
https://github.com/jaames/playdate-usb
2021 James Daniel
https://github.com/jaames/pd-usb
2022 James Daniel
Playdate is (c) Panic Inc. - this project isn't affiliated with or endorsed by them in any way
*/`;

Expand All @@ -28,22 +28,22 @@ module.exports = {
],
output: [
(isEsmoduleBuild) && {
file: 'dist/playdate-usb.es.js',
file: 'dist/pd-usb.es.js',
format: 'es',
name: 'playdateUsb',
exports: 'named',
banner: banner,
sourcemap: devserver ? true : false,
sourcemapFile: 'dist/playdate-usb.es.map'
sourcemapFile: 'dist/pd-usb.es.map'
},
(!isEsmoduleBuild) && {
file: isProdBuild ? 'dist/playdate-usb.min.js' : 'dist/playdate-usb.js',
file: isProdBuild ? 'dist/pd-usb.min.js' : 'dist/pd-usb.js',
format: 'umd',
name: 'playdateUsb',
exports: 'named',
banner: banner,
sourcemap: devserver ? true : false,
sourcemapFile: isProdBuild ? 'dist/playdate-usb.min.js.map' : 'dist/playdate-usb.js.map'
sourcemapFile: isProdBuild ? 'dist/pd-usb.min.js.map' : 'dist/pd-usb.js.map'
},
].filter(Boolean),
plugins: [
Expand Down

0 comments on commit 8b734ce

Please sign in to comment.