@hotbunny/hackhub-content-sdk 0.3.0 → 0.4.0
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 +45 -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, access exported functions via `window.ModExports`:
|
|
941
|
+
* ```html
|
|
942
|
+
* <script>
|
|
943
|
+
* const formatted = window.ModExports.formatPost("hello");
|
|
944
|
+
* </script>
|
|
945
|
+
* ```
|
|
946
|
+
*
|
|
947
|
+
* SDK APIs are available via `window.HackhubSDK`:
|
|
948
|
+
* ```html
|
|
949
|
+
* <script>
|
|
950
|
+
* window.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,11 @@ 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 via `window.ModExports`.
|
|
962
|
+
* Use this to bridge your TypeScript logic with the iframe UI.
|
|
963
|
+
*/
|
|
964
|
+
Exports?: Record<string, any>;
|
|
943
965
|
}
|
|
944
966
|
/**
|
|
945
967
|
* Base class for mod terminal commands. Mod authors extend this to
|
|
@@ -1002,8 +1024,26 @@ export declare abstract class Command {
|
|
|
1002
1024
|
* ratings: 4.5,
|
|
1003
1025
|
* description: "Generate secure passwords",
|
|
1004
1026
|
* };
|
|
1027
|
+
* Exports = {
|
|
1028
|
+
* generate: (length: number) => "x".repeat(length),
|
|
1029
|
+
* };
|
|
1005
1030
|
* }
|
|
1006
1031
|
* ```
|
|
1032
|
+
*
|
|
1033
|
+
* In your HTML, access exported functions via `window.ModExports`:
|
|
1034
|
+
* ```html
|
|
1035
|
+
* <script>
|
|
1036
|
+
* const pw = window.ModExports.generate(16);
|
|
1037
|
+
* document.getElementById("result").textContent = pw;
|
|
1038
|
+
* </script>
|
|
1039
|
+
* ```
|
|
1040
|
+
*
|
|
1041
|
+
* SDK APIs are available via `window.HackhubSDK`:
|
|
1042
|
+
* ```html
|
|
1043
|
+
* <script>
|
|
1044
|
+
* window.HackhubSDK.Events.emit("PasswordGenerated");
|
|
1045
|
+
* </script>
|
|
1046
|
+
* ```
|
|
1007
1047
|
*/
|
|
1008
1048
|
export declare abstract class App {
|
|
1009
1049
|
abstract AppName: string;
|
|
@@ -1020,6 +1060,11 @@ export declare abstract class App {
|
|
|
1020
1060
|
Store?: AppStoreDefinition;
|
|
1021
1061
|
/** If true, the app is unlocked in the AppStore by default (no quest required). */
|
|
1022
1062
|
Unlocked?: boolean;
|
|
1063
|
+
/**
|
|
1064
|
+
* Functions/values exposed to the app's HTML via `window.ModExports`.
|
|
1065
|
+
* Use this to bridge your TypeScript logic with the iframe UI.
|
|
1066
|
+
*/
|
|
1067
|
+
Exports?: Record<string, any>;
|
|
1023
1068
|
}
|
|
1024
1069
|
/**
|
|
1025
1070
|
* Game events API. Allows mods to listen to in-game events
|