unreal-toolkit 0.1.11 → 0.1.14
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 +36 -2
- package/dist/index.d.ts +24 -20
- package/dist/unreal.toolkit.d.ts +24 -20
- package/dist/unreal.toolkit.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# Unreal Toolkit - Classic Edition
|
2
|
-
A
|
2
|
+
A runtime library for advanced Unreal Engine web game development. The **Unreal Toolkit** enables interoperability
|
3
3
|
with your hosted Unreal Engine streaming web application.
|
4
4
|
|
5
5
|
<a href="https://www.npmjs.com/package/unreal-toolkit-next">Next Edition (ES6)</a>
|
6
6
|
<br/>
|
7
|
-
<a href="https://github.com/
|
7
|
+
<a href="https://github.com/codewrxai/UnrealToolkit/cdn">Browser Edition (CDN)</a>
|
8
8
|
|
9
9
|
|
10
10
|
## Default Installation (UMD)
|
@@ -16,3 +16,37 @@ npm install unreal-toolkit
|
|
16
16
|
```javascript
|
17
17
|
import UnrealToolkit from 'unreal-toolkit';
|
18
18
|
```
|
19
|
+
|
20
|
+
* Unreal Toolkit Message Bus Usage
|
21
|
+
```typescript
|
22
|
+
// Post WM_HELLO message to Unreal Engine
|
23
|
+
UnrealToolkit.EventBus.PostWindowMessage("WM_HELLO", ["Hello World!"]);
|
24
|
+
|
25
|
+
// Handle WM_MY_EVENT message from Unreal Engine
|
26
|
+
UnrealToolkit.EventBus.OnWindowMessage("WM_MY_EVENT", (args:string[]) => {
|
27
|
+
console.log("My Event Args: ", args);
|
28
|
+
});
|
29
|
+
```
|
30
|
+
|
31
|
+
* Unreal Toolkit Content Frame Style
|
32
|
+
```css
|
33
|
+
iframe {
|
34
|
+
position: absolute;
|
35
|
+
width: 100%;
|
36
|
+
height: 100%;
|
37
|
+
min-height: 100vh;
|
38
|
+
border: none;
|
39
|
+
outline: none;
|
40
|
+
z-index: 0;
|
41
|
+
}
|
42
|
+
```
|
43
|
+
|
44
|
+
* Unreal Toolkit Content Frame Window
|
45
|
+
```html
|
46
|
+
<iframe
|
47
|
+
src="your.unrealtoolkitproject.com"
|
48
|
+
crossorigin="anonymous"
|
49
|
+
allow="cross-origin-isolated"
|
50
|
+
sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-pointer-lock">
|
51
|
+
</iframe>
|
52
|
+
```
|
package/dist/index.d.ts
CHANGED
@@ -8,13 +8,13 @@ export declare class UnrealToolkit {
|
|
8
8
|
/** Unreal Toolkit event message bus
|
9
9
|
* @example
|
10
10
|
* ```typescript
|
11
|
-
* //
|
12
|
-
* UnrealToolkit.EventBus.
|
13
|
-
* console.log("My Event Data: " + data);
|
14
|
-
* });
|
11
|
+
* // Post WM_HELLO message to Unreal Engine
|
12
|
+
* UnrealToolkit.EventBus.PostWindowMessage("WM_HELLO", ["Hello World!"]);
|
15
13
|
*
|
16
|
-
* //
|
17
|
-
* UnrealToolkit.EventBus.
|
14
|
+
* // Handle WM_MY_EVENT message from Unreal Engine
|
15
|
+
* UnrealToolkit.EventBus.OnWindowMessage("WM_MY_EVENT", (args:string[]) => {
|
16
|
+
* console.log("My Event Args: ", args);
|
17
|
+
* });
|
18
18
|
* ```
|
19
19
|
*/
|
20
20
|
static get EventBus(): UnrealMessageBus;
|
@@ -24,28 +24,28 @@ export declare class UnrealToolkit {
|
|
24
24
|
* @class UnrealMessageBus - All rights reserved (c) 2024 Mackey Kinard
|
25
25
|
*/
|
26
26
|
export declare class UnrealMessageBus {
|
27
|
-
|
27
|
+
static AllowedOrigin: string;
|
28
|
+
static TargetOrigin: string;
|
29
|
+
static ContentFrames: NodeListOf<HTMLIFrameElement>;
|
28
30
|
constructor();
|
29
|
-
/**
|
30
|
-
* @param
|
31
|
-
* @param
|
31
|
+
/** Post event bus message
|
32
|
+
* @param name The message to post
|
33
|
+
* @param args The args to post
|
32
34
|
* @returns void
|
33
35
|
*/
|
34
|
-
|
35
|
-
/**
|
36
|
-
* @param
|
37
|
-
* @param
|
38
|
-
* @param target The target to post
|
39
|
-
* @param transfer The transfer to post
|
36
|
+
PostWindowMessage(name: string, args?: string[]): void;
|
37
|
+
/** Handle event bus message
|
38
|
+
* @param name The name to handle
|
39
|
+
* @param args The args to handle
|
40
40
|
* @returns void
|
41
41
|
*/
|
42
|
-
|
42
|
+
OnWindowMessage(name: string, handler: (args: string[]) => void): void;
|
43
43
|
/** Remove event bus message handler
|
44
44
|
* @param message The message to remove
|
45
45
|
* @param handler The handler to remove
|
46
46
|
* @returns void
|
47
47
|
*/
|
48
|
-
RemoveHandler(message: string, handler: (
|
48
|
+
RemoveHandler(message: string, handler: (args: string[]) => void): void;
|
49
49
|
/** Clear and reset all event bus message handlers
|
50
50
|
* @returns void
|
51
51
|
*/
|
@@ -54,14 +54,18 @@ export declare class UnrealMessageBus {
|
|
54
54
|
* @returns void
|
55
55
|
*/
|
56
56
|
Dispose(): void;
|
57
|
+
/** Resets the content frame list
|
58
|
+
* @returns void
|
59
|
+
*/
|
60
|
+
ResetContentFrames(): void;
|
57
61
|
/** Handle window message event
|
58
62
|
* @param event The message event to handle
|
59
63
|
* @returns void
|
60
64
|
*/
|
61
65
|
private HandleWindowMessage;
|
62
66
|
/** Dispatch internal event bus message
|
63
|
-
* @param
|
64
|
-
* @param
|
67
|
+
* @param name The name to dispatch
|
68
|
+
* @param args The args to dispatch
|
65
69
|
* @returns void
|
66
70
|
*/
|
67
71
|
private OnDispatchMessage;
|
package/dist/unreal.toolkit.d.ts
CHANGED
@@ -8,13 +8,13 @@ export declare class UnrealToolkit {
|
|
8
8
|
/** Unreal Toolkit event message bus
|
9
9
|
* @example
|
10
10
|
* ```typescript
|
11
|
-
* //
|
12
|
-
* UnrealToolkit.EventBus.
|
13
|
-
* console.log("My Event Data: " + data);
|
14
|
-
* });
|
11
|
+
* // Post WM_HELLO message to Unreal Engine
|
12
|
+
* UnrealToolkit.EventBus.PostWindowMessage("WM_HELLO", ["Hello World!"]);
|
15
13
|
*
|
16
|
-
* //
|
17
|
-
* UnrealToolkit.EventBus.
|
14
|
+
* // Handle WM_MY_EVENT message from Unreal Engine
|
15
|
+
* UnrealToolkit.EventBus.OnWindowMessage("WM_MY_EVENT", (args:string[]) => {
|
16
|
+
* console.log("My Event Args: ", args);
|
17
|
+
* });
|
18
18
|
* ```
|
19
19
|
*/
|
20
20
|
static get EventBus(): UnrealMessageBus;
|
@@ -24,28 +24,28 @@ export declare class UnrealToolkit {
|
|
24
24
|
* @class UnrealMessageBus - All rights reserved (c) 2024 Mackey Kinard
|
25
25
|
*/
|
26
26
|
export declare class UnrealMessageBus {
|
27
|
-
|
27
|
+
static AllowedOrigin: string;
|
28
|
+
static TargetOrigin: string;
|
29
|
+
static ContentFrames: NodeListOf<HTMLIFrameElement>;
|
28
30
|
constructor();
|
29
|
-
/**
|
30
|
-
* @param
|
31
|
-
* @param
|
31
|
+
/** Post event bus message
|
32
|
+
* @param name The message to post
|
33
|
+
* @param args The args to post
|
32
34
|
* @returns void
|
33
35
|
*/
|
34
|
-
|
35
|
-
/**
|
36
|
-
* @param
|
37
|
-
* @param
|
38
|
-
* @param target The target to post
|
39
|
-
* @param transfer The transfer to post
|
36
|
+
PostWindowMessage(name: string, args?: string[]): void;
|
37
|
+
/** Handle event bus message
|
38
|
+
* @param name The name to handle
|
39
|
+
* @param args The args to handle
|
40
40
|
* @returns void
|
41
41
|
*/
|
42
|
-
|
42
|
+
OnWindowMessage(name: string, handler: (args: string[]) => void): void;
|
43
43
|
/** Remove event bus message handler
|
44
44
|
* @param message The message to remove
|
45
45
|
* @param handler The handler to remove
|
46
46
|
* @returns void
|
47
47
|
*/
|
48
|
-
RemoveHandler(message: string, handler: (
|
48
|
+
RemoveHandler(message: string, handler: (args: string[]) => void): void;
|
49
49
|
/** Clear and reset all event bus message handlers
|
50
50
|
* @returns void
|
51
51
|
*/
|
@@ -54,14 +54,18 @@ export declare class UnrealMessageBus {
|
|
54
54
|
* @returns void
|
55
55
|
*/
|
56
56
|
Dispose(): void;
|
57
|
+
/** Resets the content frame list
|
58
|
+
* @returns void
|
59
|
+
*/
|
60
|
+
ResetContentFrames(): void;
|
57
61
|
/** Handle window message event
|
58
62
|
* @param event The message event to handle
|
59
63
|
* @returns void
|
60
64
|
*/
|
61
65
|
private HandleWindowMessage;
|
62
66
|
/** Dispatch internal event bus message
|
63
|
-
* @param
|
64
|
-
* @param
|
67
|
+
* @param name The name to dispatch
|
68
|
+
* @param args The args to dispatch
|
65
69
|
* @returns void
|
66
70
|
*/
|
67
71
|
private OnDispatchMessage;
|
package/dist/unreal.toolkit.js
CHANGED
@@ -1 +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.UnrealToolkit=n():e.UnrealToolkit=n()}(this,(()=>(()=>{"use strict";var e={d:(n,t)=>{for(var
|
1
|
+
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.UnrealToolkit=n():e.UnrealToolkit=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:()=>i});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={},this.HandleWindowMessage=this.HandleWindowMessage.bind(this),window.addEventListener("message",this.HandleWindowMessage)}return e.prototype.PostWindowMessage=function(n,t){try{null==e.ContentFrames&&(e.ContentFrames=document.querySelectorAll("iframe")),null!=e.ContentFrames?e.ContentFrames.forEach((function(o){var i;try{null===(i=o.contentWindow)||void 0===i||i.postMessage({source:"unrealtoolkit",message:n,args:t},e.TargetOrigin)}catch(e){console.warn(e)}})):console.warn("UnrealMessageBus: No Content Frames Found!")}catch(e){console.warn(e)}},e.prototype.OnWindowMessage=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.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.removeEventListener("message",this.HandleWindowMessage)},e.prototype.ResetContentFrames=function(){e.ContentFrames=null},e.prototype.HandleWindowMessage=function(n){if(null!=n&&null!=n.origin&&null!=n.data)if(null==e.AllowedOrigin||""===e.AllowedOrigin||"*"===e.AllowedOrigin||n.origin===e.AllowedOrigin){var t=null,o=null;null!=n.data.type?"progress"===n.data.type&&null!=n.data.value?(t="WM_PROGRESS",o=[n.data.value.toString()]):"LoadComplete"===n.data.type?(t="WM_LOAD_COMPLETE",o=null):"focus"===n.data.type?(t="WM_FOCUS",o=null):"blur"===n.data.type?(t="WM_BLUR",o=null):"pointer-lock-active"===n.data.type?(t="WM_POINTER_LOCK_ACTIVE",o=null):"pointer-lock-inactive"===n.data.type&&(t="WM_POINTER_LOCK_INACTIVE",o=null):null!=n.data.source&&"unrealtoolkit"===n.data.source&&null!=n.data.message&&(t=n.data.message,o=null!=n.data.args?n.data.args:null);try{null!=t&&this.OnDispatchMessage(t,o)}catch(e){console.warn(e)}}else console.warn("UnrealMessageBus: Invalid Origin: "+n.origin)},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.AllowedOrigin="*",e.TargetOrigin="*",e.ContentFrames=null,e}();console.log("Unreal Toolkit Runtime - Version 0.1.8");const i=t;return n.default})()));
|