Worker message @JsExport example

This commit is contained in:
2020-08-19 10:42:24 +02:00
commit 36990a18b6
44 changed files with 752 additions and 0 deletions

11
web/index.html Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
<script src="test-worker-message.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,2 @@
var worker=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){var r,o,a;o=[e],void 0===(a="function"==typeof(r=function(t){"use strict";function e(){n=this}var n,r;function o(){}function a(t,e){null!=Error.captureStackTrace?Error.captureStackTrace(t,e):t.stack=(new Error).stack}function i(t,e,n){Error.call(t),function(t,e,n){if(!c(t,"message")){var r,o=e;if(null==o){var a=n;r=null==a?null:a.toString()}else r=o;var i=r;t.message=null==i?void 0:i}c(t,"cause")||(t.cause=n),t.name=Object.getPrototypeOf(t).constructor.name}(t,e,n)}function c(t,e){return Object.getPrototypeOf(t).hasOwnProperty(e)}function u(t,e){var n=y(t,4294901760)*y(e,65535),r=y(t,65535)*e;return n+r|0}function s(){a(this,s)}function p(){a(this,p)}function l(){a(this,l)}function f(t){return function(t){i(t,null,null),s.call(t)}(t),p.call(t),t}function m(){var t,e=(f(t=Object.create(l.prototype)),l.call(t),t);return a(e,m),e}function y(t,e){return t&e}function _(t,e){this._name=t,this._age=e}function g(){r=this,this._id="<id not set>"}function d(t){this._$boundThis=t}return s.prototype=Object.create(Error.prototype),s.prototype.constructor=s,p.prototype=Object.create(s.prototype),p.prototype.constructor=p,l.prototype=Object.create(p.prototype),l.prototype.constructor=l,e.prototype.toString=function(){return"kotlin.Unit"},e.$metadata$={simpleName:"Unit",kind:"object",interfaces:[]},o.$metadata$={simpleName:"KCallable",kind:"interface",interfaces:[]},s.$metadata$={simpleName:"Exception",kind:"class",interfaces:[]},p.$metadata$={simpleName:"RuntimeException",kind:"class",interfaces:[]},l.$metadata$={simpleName:"ClassCastException",kind:"class",interfaces:[]},_.prototype._get_name__0=function(){return this._name},_.prototype._get_age_=function(){return this._age},_.prototype.component1=function(){return this._name},_.prototype.component2=function(){return this._age},_.prototype.copy=function(t,e){return new _(t,e)},_.prototype.copy$default=function(t,e,n,r){var o=0!=(1&n)?this._name:t,a=0!=(2&n)?this._age:e;return this.copy(o,a)},_.prototype.toString=function(){return"WorkerMessage(name="+this._name+", age="+this._age+")"},_.prototype.hashCode=function(){return u(function(t){var e=0,n=t.length,r=0,o=n-1|0;if(r<=o)do{var a=r;r=r+1|0;var i=t.charCodeAt(a);e=u(e,31)+i|0}while(a!==o);return e}(this._name),31)+this._age|0},_.prototype.equals=function(t){if(this===t)return!0;if(!(t instanceof _))return!1;var e=t instanceof _?t:function(){throw m()}();return this._name===e._name&&this._age===e._age},_.$metadata$={simpleName:"WorkerMessage",kind:"class",interfaces:[]},Object.defineProperty(_.prototype,"name",{configurable:!0,get:_.prototype._get_name__0}),Object.defineProperty(_.prototype,"age",{configurable:!0,get:_.prototype._get_age_}),g.prototype.start_0=function(){var t,r;(function(){var t=console;return t.log.apply(t,[].concat([].slice.call(["Worker.start"])))}).call(this),self.onmessage=(t=new d(this),(r=function(r){return t.invoke(r),null==n&&new e,n}).callableName=t._get_name__0(),r)},g.prototype.receiveMessage=function(t){if(t instanceof MessageEvent){var e=t.data;(function(){var t=console;return t.log.apply(t,[].concat([].slice.call(["Received message:",e])))}).call(this)}},g.$metadata$={simpleName:"Worker",kind:"object",interfaces:[]},d.prototype.invoke=function(t){return this._$boundThis.receiveMessage(t)},d.prototype._get_name__0=function(){return"receiveMessage"},d.$metadata$={kind:"class",interfaces:[]},t.WorkerMessage=_,(null==r&&new g,r).start_0(),t})?r.apply(e,o):r)||(t.exports=a)}]);
//# sourceMappingURL=test-worker-message.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["test-worker-message"]=t():e["test-worker-message"]=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){e.exports=r(1)},function(e,t){!function(e){"use strict";function t(e,t){null!=Error.captureStackTrace?Error.captureStackTrace(e,t):e.stack=(new Error).stack}function r(e,t,r){Error.call(e),function(e,t,r){if(!n(e,"message")){var o,a=t;if(null==a){var c=r;o=null==c?null:c.toString()}else o=a;var i=o;e.message=null==i?void 0:i}n(e,"cause")||(e.cause=r);e.name=Object.getPrototypeOf(e).constructor.name}(e,t,r)}function n(e,t){return Object.getPrototypeOf(e).hasOwnProperty(t)}function o(e,t){var r=p(e,4294901760)*p(t,65535),n=p(e,65535)*t;return r+n|0}function a(){t(this,a)}function c(){t(this,c)}function i(){t(this,i)}function u(e){return function(e){r(e,null,null),a.call(e)}(e),c.call(e),e}function s(){var e,r=(u(e=Object.create(i.prototype)),i.call(e),e);return t(r,s),r}function p(e,t){return e&t}function f(e,t){this._name=e,this._age=t}a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,c.prototype=Object.create(a.prototype),c.prototype.constructor=c,i.prototype=Object.create(c.prototype),i.prototype.constructor=i,a.$metadata$={simpleName:"Exception",kind:"class",interfaces:[]},c.$metadata$={simpleName:"RuntimeException",kind:"class",interfaces:[]},i.$metadata$={simpleName:"ClassCastException",kind:"class",interfaces:[]},f.prototype._get_name_=function(){return this._name},f.prototype._get_age_=function(){return this._age},f.prototype.component1=function(){return this._name},f.prototype.component2=function(){return this._age},f.prototype.copy=function(e,t){return new f(e,t)},f.prototype.copy$default=function(e,t,r,n){var o=0!=(1&r)?this._name:e,a=0!=(2&r)?this._age:t;return this.copy(o,a)},f.prototype.toString=function(){return"WorkerMessage(name="+this._name+", age="+this._age+")"},f.prototype.hashCode=function(){return o(function(e){var t=0,r=0,n=e.length-1|0;if(r<=n)do{var a=r;r=r+1|0;var c=e.charCodeAt(a);t=o(t,31)+c|0}while(a!==n);return t}(this._name),31)+this._age|0},f.prototype.equals=function(e){if(this===e)return!0;if(!(e instanceof f))return!1;var t=e instanceof f?e:function(){throw s()}();return this._name===t._name&&this._age===t._age},f.$metadata$={simpleName:"WorkerMessage",kind:"class",interfaces:[]},Object.defineProperty(f.prototype,"name",{configurable:!0,get:f.prototype._get_name_}),Object.defineProperty(f.prototype,"age",{configurable:!0,get:f.prototype._get_age_}),e.WorkerMessage=f,function(){var e=new Worker("js/worker/test-worker-message.js",void 0),t=new f("Test",42);(function(){var e=console;return e.log.apply(e,[].concat([].slice.call(["Sending message: ",t])))}).call(this),e.postMessage(t,void 0)}()}(e.exports)}])}));
//# sourceMappingURL=test-worker-message.js.map

File diff suppressed because one or more lines are too long