mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
Fix this is not a constructor error on startup
When passing methods around they lose their binding to this, which means the fromJSON methods no longer has this be their class. Fix by binding the methods to the class they belong to before passing them on to the datastore.
This commit is contained in:
1 parent
6226a45d0b
commit
95396ff1c3
1 file changed
+4
-4
@@ -102,12 +102,12 @@ export default class Controller {
|
||||
|
||||
const systems = new lib.SubscribableDatastore(...await new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "systems.json"),
|
||||
lib.SystemInfo.fromJSON
|
||||
lib.SystemInfo.fromJSON.bind(lib.SystemInfo)
|
||||
).bootstrap());
|
||||
|
||||
const hosts = new lib.SubscribableDatastore(...await new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "hosts.json"),
|
||||
HostInfo.fromJSON,
|
||||
HostInfo.fromJSON.bind(HostInfo),
|
||||
this.migrateHosts, this.finaliseHosts,
|
||||
).bootstrap());
|
||||
|
||||
@@ -119,12 +119,12 @@ export default class Controller {
|
||||
|
||||
const saves = new lib.SubscribableDatastore(...await new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "saves.json"),
|
||||
lib.SaveDetails.fromJSON
|
||||
lib.SaveDetails.fromJSON.bind(lib.SaveDetails)
|
||||
).bootstrap());
|
||||
|
||||
const modPacks = new lib.SubscribableDatastore(...await new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "mod-packs.json"),
|
||||
lib.ModPack.fromJSON
|
||||
lib.ModPack.fromJSON.bind(lib.ModPack)
|
||||
).bootstrap());
|
||||
|
||||
const userManager = new UserManager(config);
|
||||
|
||||
Reference in new issue
Block a user