2.0.4 • Published 12 months ago
@fsuipc.js/api v2.0.4
FSUIPC client implementation for NodeJS.
@fsuipc.js/api
This package allows you to read +800 predefined offsets.
Quick start
- Install
fsuipc.js
and@fsuipc.js/api
:
yarn add fsuipc.js @fsuipc.js/api
- Import the module and create a new object:
import { FsuipcApi } from '@fsuipc.js/api';
const simulator = new FsuipcApi(Simulator.FSX);
3: Use the method init
to request a list of offsets and then, read the value in the promise:
simulator
.init()
.then(() => {
simulator.listen(true, 2000, ['gs', 'altitude', 'comFreq', 'lights']).subscribe((result) => {
console.log(JSON.stringify(result));
});
})
.catch((e) => console.error(e));
Methods:
Init:
Returns a promise when you are properly connected to FSUIPC stream. In case your flight simulator isn't running, this will throw an error.
Listen:
Listen a list of offsets.
listen method takes 2-3 arguments:
- intervalnumber: interval at which values will be polled from FSUIPC stream.
- offsetsList[string[]]: a list of string representing offsets you want to subscribe on.
- terminateOnErrorboolean: if set to true, if any value is errored, you will be disconnected from FSUIPC stream.
This method returns a ConvertedOffsetValues observable. You can subscribe to this observable to handle values polled from stream.
Close:
Closes a running connection.
2.0.3
12 months ago
2.0.2
1 year ago
2.0.1-alpha.0
1 year ago
2.0.4
12 months ago
2.0.1-alpha.1
1 year ago
1.1.2-alpha.0
1 year ago
2.0.1
1 year ago
2.0.0
1 year ago
1.1.1
3 years ago
1.1.0
3 years ago
1.0.0
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.3-alpha.0
3 years ago
0.0.2-alpha.0
3 years ago
0.0.1
3 years ago