unreal-toolkit 0.1.12 → 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 +30 -7
- package/dist/index.d.ts +9 -4
- package/dist/unreal.toolkit.d.ts +9 -4
- 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)
|
@@ -19,11 +19,34 @@ import UnrealToolkit from 'unreal-toolkit';
|
|
19
19
|
|
20
20
|
* Unreal Toolkit Message Bus Usage
|
21
21
|
```typescript
|
22
|
-
// Post
|
23
|
-
UnrealToolkit.EventBus.PostWindowMessage("
|
22
|
+
// Post WM_HELLO message to Unreal Engine
|
23
|
+
UnrealToolkit.EventBus.PostWindowMessage("WM_HELLO", ["Hello World!"]);
|
24
24
|
|
25
|
-
// Handle
|
26
|
-
UnrealToolkit.EventBus.OnWindowMessage("
|
25
|
+
// Handle WM_MY_EVENT message from Unreal Engine
|
26
|
+
UnrealToolkit.EventBus.OnWindowMessage("WM_MY_EVENT", (args:string[]) => {
|
27
27
|
console.log("My Event Args: ", args);
|
28
28
|
});
|
29
|
-
```
|
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,11 +8,11 @@ export declare class UnrealToolkit {
|
|
8
8
|
/** Unreal Toolkit event message bus
|
9
9
|
* @example
|
10
10
|
* ```typescript
|
11
|
-
* // Post
|
12
|
-
* UnrealToolkit.EventBus.PostWindowMessage("
|
11
|
+
* // Post WM_HELLO message to Unreal Engine
|
12
|
+
* UnrealToolkit.EventBus.PostWindowMessage("WM_HELLO", ["Hello World!"]);
|
13
13
|
*
|
14
|
-
* // Handle
|
15
|
-
* UnrealToolkit.EventBus.OnWindowMessage("
|
14
|
+
* // Handle WM_MY_EVENT message from Unreal Engine
|
15
|
+
* UnrealToolkit.EventBus.OnWindowMessage("WM_MY_EVENT", (args:string[]) => {
|
16
16
|
* console.log("My Event Args: ", args);
|
17
17
|
* });
|
18
18
|
* ```
|
@@ -26,6 +26,7 @@ export declare class UnrealToolkit {
|
|
26
26
|
export declare class UnrealMessageBus {
|
27
27
|
static AllowedOrigin: string;
|
28
28
|
static TargetOrigin: string;
|
29
|
+
static ContentFrames: NodeListOf<HTMLIFrameElement>;
|
29
30
|
constructor();
|
30
31
|
/** Post event bus message
|
31
32
|
* @param name The message to post
|
@@ -53,6 +54,10 @@ export declare class UnrealMessageBus {
|
|
53
54
|
* @returns void
|
54
55
|
*/
|
55
56
|
Dispose(): void;
|
57
|
+
/** Resets the content frame list
|
58
|
+
* @returns void
|
59
|
+
*/
|
60
|
+
ResetContentFrames(): void;
|
56
61
|
/** Handle window message event
|
57
62
|
* @param event The message event to handle
|
58
63
|
* @returns void
|
package/dist/unreal.toolkit.d.ts
CHANGED
@@ -8,11 +8,11 @@ export declare class UnrealToolkit {
|
|
8
8
|
/** Unreal Toolkit event message bus
|
9
9
|
* @example
|
10
10
|
* ```typescript
|
11
|
-
* // Post
|
12
|
-
* UnrealToolkit.EventBus.PostWindowMessage("
|
11
|
+
* // Post WM_HELLO message to Unreal Engine
|
12
|
+
* UnrealToolkit.EventBus.PostWindowMessage("WM_HELLO", ["Hello World!"]);
|
13
13
|
*
|
14
|
-
* // Handle
|
15
|
-
* UnrealToolkit.EventBus.OnWindowMessage("
|
14
|
+
* // Handle WM_MY_EVENT message from Unreal Engine
|
15
|
+
* UnrealToolkit.EventBus.OnWindowMessage("WM_MY_EVENT", (args:string[]) => {
|
16
16
|
* console.log("My Event Args: ", args);
|
17
17
|
* });
|
18
18
|
* ```
|
@@ -26,6 +26,7 @@ export declare class UnrealToolkit {
|
|
26
26
|
export declare class UnrealMessageBus {
|
27
27
|
static AllowedOrigin: string;
|
28
28
|
static TargetOrigin: string;
|
29
|
+
static ContentFrames: NodeListOf<HTMLIFrameElement>;
|
29
30
|
constructor();
|
30
31
|
/** Post event bus message
|
31
32
|
* @param name The message to post
|
@@ -53,6 +54,10 @@ export declare class UnrealMessageBus {
|
|
53
54
|
* @returns void
|
54
55
|
*/
|
55
56
|
Dispose(): void;
|
57
|
+
/** Resets the content frame list
|
58
|
+
* @returns void
|
59
|
+
*/
|
60
|
+
ResetContentFrames(): void;
|
56
61
|
/** Handle window message event
|
57
62
|
* @param event The message event to handle
|
58
63
|
* @returns void
|
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})()));
|