Skip to content

Anatoly03/pixelwalker.js

Repository files navigation

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.

About

PixelWalker API bindings

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •