pixelwalker.js
TypeScript icon, indicating that this package has built-in type declarations

1.4.13 • Public • Published

PixelWalker SDK

NPM | GitHub | Protocol

npm i --save pixelwalker.js

Example: Connecting

import "dotenv/config";
import { APIClient, Block } from "pixelwalker.js";

const client = APIClient.withToken(process.env.TOKEN!)!;
const game = await client.createGame("r450e0e380a815a");

game.listen("Init", () => {
    console.log("Init!");
});

game.bind();

Using in the browser

Per default, this library will not work in the browser without downloading the polyfill node modules, below is an example how you can achieve this using the vite-plugin-node-polyfills module, which will help with bundling node-native, which this library uses: events

npm i --save pixelwalker.js
npm i --save-dev vite-plugin-node-polyfills
// vite.config.ts
import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'

export default defineConfig({
  plugins: [
    nodePolyfills({
      include: ['events'],
      globals: { process: true },
    }),
  ],
})

Contribution

npm install             # Install `node_modules`
npm run build           # Execute this after making changes to the library.

Installing the node packages will also build the project into dist.

Readme

Keywords

none

Package Sidebar

Install

npm i pixelwalker.js

Weekly Downloads

44

Version

1.4.13

License

ISC

Unpacked Size

724 kB

Total Files

103

Last publish

Collaborators

  • anatoly03