Skip to content

Latest commit

 

History

History

bridge

@vextjs/bridge npm

A typesafe extendable interface to communicate with VEXT and manage input and display order

Installation

With npm

npm i -D @vextjs/bridge

With yarn

yarn -D @vextjs/bridge

Usage

Usage of this package is fairly simple, most documentation can be found in the TSDocs. Below is an example on how to use Bridge to switch between implementations, depending whether you are running in a VEXT environment (in-game or in-browser)

import {
  isVextEnvironment,
  VextBridge,
  VextNoopBridge,
  VextWebUIBridge,
} from '@vextjs/bridge';

let vext: VextBridge;
if (isVextEnvironment()) {
  vext = new VextWebUIBridge();
} else {
  vext = new VextNoopBridge();
}

vext.DispatchEventLocal('KickPlayer', 5, 'Stop killing me');

We also have an emulator as extension on that you can check out here. This replaces the no operation implementation with one that allows you to register local and global event listeners, just like you would in VEXT itself.

Development

Building

Run nx build bridge to build the library.

Running unit tests

Run nx test bridge to execute the unit tests via Jest.