@hotbunny/hackhub-content-sdk 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +47 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -931,8 +931,25 @@ export declare abstract class Quest {
|
|
|
931
931
|
* { path: "/", title: "Home", html: homePage },
|
|
932
932
|
* { path: "/about", title: "About", html: aboutPage },
|
|
933
933
|
* ];
|
|
934
|
+
* Exports = {
|
|
935
|
+
* formatPost: (text: string) => text.toUpperCase(),
|
|
936
|
+
* };
|
|
934
937
|
* }
|
|
935
938
|
* ```
|
|
939
|
+
*
|
|
940
|
+
* In your HTML, exported functions are available as globals:
|
|
941
|
+
* ```html
|
|
942
|
+
* <script>
|
|
943
|
+
* const formatted = formatPost("hello");
|
|
944
|
+
* </script>
|
|
945
|
+
* ```
|
|
946
|
+
*
|
|
947
|
+
* SDK APIs are available via the `HackhubSDK` global:
|
|
948
|
+
* ```html
|
|
949
|
+
* <script>
|
|
950
|
+
* HackhubSDK.Mail.send({ to: "user@mail.com", subject: "Hi" });
|
|
951
|
+
* </script>
|
|
952
|
+
* ```
|
|
936
953
|
*/
|
|
937
954
|
export declare abstract class Website {
|
|
938
955
|
abstract SiteName: string;
|
|
@@ -940,6 +957,12 @@ export declare abstract class Website {
|
|
|
940
957
|
abstract Icon: string;
|
|
941
958
|
abstract Pages: WebsitePageDefinition[];
|
|
942
959
|
Popular?: boolean;
|
|
960
|
+
/**
|
|
961
|
+
* Functions/values exposed to all pages' HTML as globals.
|
|
962
|
+
* Each key becomes directly callable in your HTML scripts (e.g. `formatPost("hello")`).
|
|
963
|
+
* Also accessible via the `ModExports` namespace.
|
|
964
|
+
*/
|
|
965
|
+
Exports?: Record<string, any>;
|
|
943
966
|
}
|
|
944
967
|
/**
|
|
945
968
|
* Base class for mod terminal commands. Mod authors extend this to
|
|
@@ -1002,8 +1025,26 @@ export declare abstract class Command {
|
|
|
1002
1025
|
* ratings: 4.5,
|
|
1003
1026
|
* description: "Generate secure passwords",
|
|
1004
1027
|
* };
|
|
1028
|
+
* Exports = {
|
|
1029
|
+
* generate: (length: number) => "x".repeat(length),
|
|
1030
|
+
* };
|
|
1005
1031
|
* }
|
|
1006
1032
|
* ```
|
|
1033
|
+
*
|
|
1034
|
+
* In your HTML, exported functions are available as globals:
|
|
1035
|
+
* ```html
|
|
1036
|
+
* <script>
|
|
1037
|
+
* const pw = generate(16);
|
|
1038
|
+
* document.getElementById("result").textContent = pw;
|
|
1039
|
+
* </script>
|
|
1040
|
+
* ```
|
|
1041
|
+
*
|
|
1042
|
+
* SDK APIs are available via the `HackhubSDK` global:
|
|
1043
|
+
* ```html
|
|
1044
|
+
* <script>
|
|
1045
|
+
* HackhubSDK.Events.emit("PasswordGenerated");
|
|
1046
|
+
* </script>
|
|
1047
|
+
* ```
|
|
1007
1048
|
*/
|
|
1008
1049
|
export declare abstract class App {
|
|
1009
1050
|
abstract AppName: string;
|
|
@@ -1020,6 +1061,12 @@ export declare abstract class App {
|
|
|
1020
1061
|
Store?: AppStoreDefinition;
|
|
1021
1062
|
/** If true, the app is unlocked in the AppStore by default (no quest required). */
|
|
1022
1063
|
Unlocked?: boolean;
|
|
1064
|
+
/**
|
|
1065
|
+
* Functions/values exposed to the app's HTML as globals.
|
|
1066
|
+
* Each key becomes directly callable in your HTML scripts (e.g. `generate(16)`).
|
|
1067
|
+
* Also accessible via the `ModExports` namespace.
|
|
1068
|
+
*/
|
|
1069
|
+
Exports?: Record<string, any>;
|
|
1023
1070
|
}
|
|
1024
1071
|
/**
|
|
1025
1072
|
* Game events API. Allows mods to listen to in-game events
|