Skip to content

Commit

Permalink
fix: Adding a "boostrapExtra()" function to bootstrap the extra script.
Browse files Browse the repository at this point in the history
  • Loading branch information
moufmouf committed Sep 1, 2021
1 parent 43931f9 commit 127bce7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
// This file automatically bootstraps all the features on WA initialization.
// Importing this file creates a number of side effects.

import { initDoors } from "./Features/doors";
import { initConfiguration } from "./Features/configuration";
import { initPropertiesTemplates } from "./Features/properties_templates";
import {initSpecialProperties} from "./Features/special_properties";
import {bootstrapExtra} from "./init";

WA.onInit().then(() => {
initDoors().catch((e) => console.error(e));
initSpecialProperties().catch((e) => console.error(e));
initConfiguration().catch((e) => console.error(e));
initPropertiesTemplates().catch((e) => console.error(e));
});
bootstrapExtra();

export {};
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * from "./LayersExtra";
export * from "./Features/properties_templates";
export * from "./Features/doors";
export * from "./Features/variable_actions";
export * from "./init";
17 changes: 17 additions & 0 deletions src/init.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {initDoors} from "./Features/doors";
import {initSpecialProperties} from "./Features/special_properties";
import {initConfiguration} from "./Features/configuration";
import {initPropertiesTemplates} from "./Features/properties_templates";

/**
* Bootstraps all the features of the extra library.
* This function must be called once if you are importing this library in your own WorkAdventure script.
*/
export function bootstrapExtra(): Promise<void> {
return WA.onInit().then(() => {
initDoors().catch((e) => console.error(e));
initSpecialProperties().catch((e) => console.error(e));
initConfiguration().catch((e) => console.error(e));
initPropertiesTemplates().catch((e) => console.error(e));
});
}

0 comments on commit 127bce7

Please sign in to comment.