unreal-toolkit 0.0.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/README.md +18 -0
- package/dist/index.d.ts +69 -0
- package/dist/unreal.toolkit.d.ts +69 -0
- package/dist/unreal.toolkit.js +1 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Unreal Toolkit - Classic Edition
|
|
2
|
+
A universal runtime library for advanced Unreal Engine web game development. The **Unreal Toolkit** requires
|
|
3
|
+
the **TOOLKIT** namespaces to be globally accessible.
|
|
4
|
+
|
|
5
|
+
<a href="https://www.npmjs.com/package/unreal-toolkit-next">Next Edition (ES6)</a>
|
|
6
|
+
<br/>
|
|
7
|
+
<a href="https://github.com/UnrealJS/UnrealToolkit/tree/master/Runtime">Browser Edition (CDN)</a>
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Default Installation (UMD)
|
|
11
|
+
```bash
|
|
12
|
+
npm install unreal-toolkit
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
* Default Toolkit Import Libraries
|
|
16
|
+
```javascript
|
|
17
|
+
import TOOLKIT from 'unreal-toolkit';
|
|
18
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** UMD Type References */
|
|
2
|
+
/**
|
|
3
|
+
* Unreal Toolkit (Static Manager Pattern)
|
|
4
|
+
* @class UnrealToolkit - All rights reserved (c) 2024 Mackey Kinard
|
|
5
|
+
*/
|
|
6
|
+
export declare class UnrealToolkit {
|
|
7
|
+
private static _EventBus;
|
|
8
|
+
/** Unreal Toolkit event message bus
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Handle myevent message
|
|
12
|
+
* UnrealToolkit.EventBus.OnMessage("myevent", (data:string) => {
|
|
13
|
+
* console.log("My Event Data: " + data);
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* // Post myevent message
|
|
17
|
+
* UnrealToolkit.EventBus.PostMessage("myevent", "Hello World!");
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
static get EventBus(): UnrealMessageBus;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Unreal Toolkit Message Bus (Asynchronous Post Message Communication)
|
|
24
|
+
* @class UnrealMessageBus - All rights reserved (c) 2024 Mackey Kinard
|
|
25
|
+
*/
|
|
26
|
+
export declare class UnrealMessageBus {
|
|
27
|
+
constructor();
|
|
28
|
+
/** Handle event bus message
|
|
29
|
+
* @param message The message to handle
|
|
30
|
+
* @param data The data to handle
|
|
31
|
+
* @returns void
|
|
32
|
+
*/
|
|
33
|
+
OnMessage(message: string, handler: (data: string) => void): void;
|
|
34
|
+
/** Post event bus message
|
|
35
|
+
* @param message The message to post
|
|
36
|
+
* @param data The data to post
|
|
37
|
+
* @param target The target to post
|
|
38
|
+
* @param transfer The transfer to post
|
|
39
|
+
* @returns void
|
|
40
|
+
*/
|
|
41
|
+
PostMessage(message: string, data?: string): void;
|
|
42
|
+
/** Remove event bus message handler
|
|
43
|
+
* @param message The message to remove
|
|
44
|
+
* @param handler The handler to remove
|
|
45
|
+
* @returns void
|
|
46
|
+
*/
|
|
47
|
+
RemoveHandler(message: string, handler: (data: string) => void): void;
|
|
48
|
+
/** Clear and reset all event bus message handlers
|
|
49
|
+
* @returns void
|
|
50
|
+
*/
|
|
51
|
+
ResetHandlers(): void;
|
|
52
|
+
/** Dispose the unreal message bus
|
|
53
|
+
* @returns void
|
|
54
|
+
*/
|
|
55
|
+
Dispose(): void;
|
|
56
|
+
/** Handle window message event
|
|
57
|
+
* @param event The message event to handle
|
|
58
|
+
* @returns void
|
|
59
|
+
*/
|
|
60
|
+
private HandleWindowMessage;
|
|
61
|
+
/** Dispatch internal event bus message
|
|
62
|
+
* @param message The message to dispatch
|
|
63
|
+
* @param data The data to dispatch
|
|
64
|
+
* @returns void
|
|
65
|
+
*/
|
|
66
|
+
private OnDispatchMessage;
|
|
67
|
+
private ListenerDictionary;
|
|
68
|
+
}
|
|
69
|
+
export default UnrealToolkit;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** UMD Type References */
|
|
2
|
+
/**
|
|
3
|
+
* Unreal Toolkit (Static Manager Pattern)
|
|
4
|
+
* @class UnrealToolkit - All rights reserved (c) 2024 Mackey Kinard
|
|
5
|
+
*/
|
|
6
|
+
export declare class UnrealToolkit {
|
|
7
|
+
private static _EventBus;
|
|
8
|
+
/** Unreal Toolkit event message bus
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Handle myevent message
|
|
12
|
+
* UnrealToolkit.EventBus.OnMessage("myevent", (data:string) => {
|
|
13
|
+
* console.log("My Event Data: " + data);
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* // Post myevent message
|
|
17
|
+
* UnrealToolkit.EventBus.PostMessage("myevent", "Hello World!");
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
static get EventBus(): UnrealMessageBus;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Unreal Toolkit Message Bus (Asynchronous Post Message Communication)
|
|
24
|
+
* @class UnrealMessageBus - All rights reserved (c) 2024 Mackey Kinard
|
|
25
|
+
*/
|
|
26
|
+
export declare class UnrealMessageBus {
|
|
27
|
+
constructor();
|
|
28
|
+
/** Handle event bus message
|
|
29
|
+
* @param message The message to handle
|
|
30
|
+
* @param data The data to handle
|
|
31
|
+
* @returns void
|
|
32
|
+
*/
|
|
33
|
+
OnMessage(message: string, handler: (data: string) => void): void;
|
|
34
|
+
/** Post event bus message
|
|
35
|
+
* @param message The message to post
|
|
36
|
+
* @param data The data to post
|
|
37
|
+
* @param target The target to post
|
|
38
|
+
* @param transfer The transfer to post
|
|
39
|
+
* @returns void
|
|
40
|
+
*/
|
|
41
|
+
PostMessage(message: string, data?: string): void;
|
|
42
|
+
/** Remove event bus message handler
|
|
43
|
+
* @param message The message to remove
|
|
44
|
+
* @param handler The handler to remove
|
|
45
|
+
* @returns void
|
|
46
|
+
*/
|
|
47
|
+
RemoveHandler(message: string, handler: (data: string) => void): void;
|
|
48
|
+
/** Clear and reset all event bus message handlers
|
|
49
|
+
* @returns void
|
|
50
|
+
*/
|
|
51
|
+
ResetHandlers(): void;
|
|
52
|
+
/** Dispose the unreal message bus
|
|
53
|
+
* @returns void
|
|
54
|
+
*/
|
|
55
|
+
Dispose(): void;
|
|
56
|
+
/** Handle window message event
|
|
57
|
+
* @param event The message event to handle
|
|
58
|
+
* @returns void
|
|
59
|
+
*/
|
|
60
|
+
private HandleWindowMessage;
|
|
61
|
+
/** Dispatch internal event bus message
|
|
62
|
+
* @param message The message to dispatch
|
|
63
|
+
* @param data The data to dispatch
|
|
64
|
+
* @returns void
|
|
65
|
+
*/
|
|
66
|
+
private OnDispatchMessage;
|
|
67
|
+
private ListenerDictionary;
|
|
68
|
+
}
|
|
69
|
+
export default UnrealToolkit;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.TOOLKIT=n():e.TOOLKIT=n()}(this,(()=>(()=>{"use strict";var e={d:(n,t)=>{for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n)},n={};e.d(n,{default:()=>s});var t=function(){function e(){}return Object.defineProperty(e,"EventBus",{get:function(){return null==e._EventBus&&(e._EventBus=new o),e._EventBus},enumerable:!1,configurable:!0}),e._EventBus=null,e}(),o=function(){function e(){this.ListenerDictionary={},window&&window.top?(this.HandleWindowMessage=this.HandleWindowMessage.bind(this),window.top.addEventListener("message",this.HandleWindowMessage)):console.warn("UnrealMessageBus: No Top Window Available")}return e.prototype.OnMessage=function(e,n){var t;null==this.ListenerDictionary[e]?(t=[],this.ListenerDictionary[e]=t):t=this.ListenerDictionary[e],t.findIndex((function(e){return n==e}))<0&&t.push(n)},e.prototype.PostMessage=function(e,n){window&&window.top?window.top.postMessage({source:"unrealmessagebus",message:e,data:n}):console.warn("UnrealMessageBus: No Top Window Available")},e.prototype.RemoveHandler=function(e,n){var t=this.ListenerDictionary[e];if(null!=t){var o=t.findIndex((function(e){return n==e}));o>=0&&t.splice(o,1)}},e.prototype.ResetHandlers=function(){this.ListenerDictionary={}},e.prototype.Dispose=function(){this.ResetHandlers(),window&&window.top&&window.top.removeEventListener("message",this.HandleWindowMessage)},e.prototype.HandleWindowMessage=function(e){null!=e&&null!=e.data&&null!=e.data.message&&null!=e.data.source&&"unrealmessagebus"==e.data.source&&this.OnDispatchMessage(e.data.message,null!=e.data.data?e.data.data:null)},e.prototype.OnDispatchMessage=function(e,n){void 0===n&&(n=null);var t=this.ListenerDictionary[e];null!=t&&t.forEach((function(e){try{e&&e(n)}catch(e){console.warn(e)}}))},e}();"undefined"!=typeof window&&(window.UnrealToolkit=t),console.log("Unreal Toolkit Runtime - Version 0.0.1");const s=t;return n.default})()));
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "unreal-toolkit",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Unreal Toolkit Runtime Library (UMD)",
|
|
5
|
+
"main": "dist/unreal.toolkit.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"clean": "rimraf dist",
|
|
9
|
+
"build": "npm run build-all",
|
|
10
|
+
"build-ts": "webpack --mode production",
|
|
11
|
+
"build-all": "npm run clean && npm run build-ts && npm run create-dts",
|
|
12
|
+
"create-dts": "node ./create-dts.js"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"unrealjs",
|
|
16
|
+
"unreal-toolkit",
|
|
17
|
+
"game-development",
|
|
18
|
+
"wasm",
|
|
19
|
+
"webgl",
|
|
20
|
+
"webgpu"
|
|
21
|
+
],
|
|
22
|
+
"files": [
|
|
23
|
+
"README.md",
|
|
24
|
+
"package.json",
|
|
25
|
+
"dist/**/*"
|
|
26
|
+
],
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"rimraf": "^6.0.1",
|
|
29
|
+
"ts-loader": "^9.5.1",
|
|
30
|
+
"typescript": "^5.5.4",
|
|
31
|
+
"webpack": "^5.93.0",
|
|
32
|
+
"webpack-cli": "^5.1.4"
|
|
33
|
+
}
|
|
34
|
+
}
|