node-gamedig/lib/index.js

25 lines
511 B
JavaScript
Raw Normal View History

import QueryRunner from './QueryRunner.js';
2014-10-29 08:02:03 +01:00
2019-01-12 11:43:36 +01:00
let singleton = null;
2014-10-29 08:02:03 +01:00
export default class Gamedig {
constructor(runnerOpts) {
this.queryRunner = new QueryRunner(runnerOpts);
2019-01-12 11:43:36 +01:00
}
2017-03-14 09:40:02 +01:00
2019-01-12 11:43:36 +01:00
async query(userOptions) {
return await this.queryRunner.run(userOptions);
}
2014-10-29 08:02:03 +01:00
2019-01-12 11:43:36 +01:00
static getInstance() {
if (!singleton)
singleton = new Gamedig();
2019-01-12 11:43:36 +01:00
return singleton;
}
static async query(...args) {
return await Gamedig.getInstance().query(...args);
2017-08-09 12:32:09 +02:00
}
}