unreal-toolkit 0.1.16 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/unreal.toolkit.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -17,7 +17,7 @@ npm install unreal-toolkit
|
|
17
17
|
import UnrealToolkit from 'unreal-toolkit';
|
18
18
|
```
|
19
19
|
|
20
|
-
* Unreal Toolkit
|
20
|
+
* Unreal Toolkit Event Bus Usage
|
21
21
|
```typescript
|
22
22
|
// Post WM_HELLO message to Unreal Engine
|
23
23
|
UnrealToolkit.EventBus.PostWindowMessage("WM_HELLO", ["Hello World!"]);
|
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 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
|
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?(t="WM_PROGRESS",o=null!=n.data.value?[n.data.value.toString()]:null):"loaded"===n.data.type?(t="WM_LOADED",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})()));
|