@openhps/core
Version:
Open Hybrid Positioning System - Core component
79 lines • 2.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
require("reflect-metadata");
const observable_1 = require("threads/observable");
const threads_1 = require("threads");
const WorkerBase_1 = require("./WorkerBase");
const worker = new WorkerBase_1.WorkerBase();
(0, threads_1.expose)({
/**
* Worker initialization
* @param {WorkerData} config Worker data containing model information
* @returns {Promise<void>} Initialize promise
*/
init(config) {
return worker.init(config);
},
/**
* Pull from this work
* @param {PullOptions} [options] Pull options
* @returns {Promise<void>} Pull promise
*/
pull(options) {
return worker.pull(options);
},
/**
* Push to this worker
* @param {DataFrame} frame Data frame
* @param {PushOptions} [options] Push options
* @returns {Promise<void>} Push promise
*/
push(frame, options) {
return worker.push(frame, options);
},
/**
* Input observable for pull requests
* @returns {Observable<void>} Observable input
*/
pullOutput() {
return observable_1.Observable.from(worker.pullOutput);
},
/**
* Output observable for push events
* @returns {Observable<any>} Observable output
*/
pushOutput() {
return observable_1.Observable.from(worker.pushOutput);
},
eventOutput() {
return observable_1.Observable.from(worker.eventOutput);
},
eventInput(name, event) {
worker.model.emit(name, event);
},
/**
* Outgoing call to a service on the main thread
* @returns {Observable<WorkerServiceCall>} Observable of outgoing service calls
*/
serviceOutputCall() {
return observable_1.Observable.from(worker.serviceOutputCall);
},
/**
* Response to an outgoing service call from the main thread
* @param {WorkerServiceResponse} input Service response
*/
serviceOutputResponse(input) {
worker.serviceOutputResponse.next(input);
},
serviceInputCall(call) {
return worker.callService(call);
},
findAllServices() {
return worker.findAllServices();
},
invokeMethod(methodName, ...args) {
return worker.invokeMethod(methodName, ...args);
},
});
exports.default = worker;
//# sourceMappingURL=WorkerRunner.js.map