petpet
Version:
virtual pet server
32 lines (24 loc) • 556 B
JavaScript
const packageData = require('../../package.json')
const Petpet = require('..')
const Stats = require('./stats')
let singleton
module.exports = class Data {
constructor(config) {
if (singleton) throw new Error('Attempted to spawn two singleton instances')
this._petpet = new Petpet(config)
this._petpet.catch(error =>
process.nextTick(() => {
throw error
})
)
}
petpet() {
return packageData.version
}
stats() {
return new Stats(this._petpet)
}
headpats() {
this._petpet.headpats()
}
}