@pizzapopcorn/unijs 0.0.6 → 0.0.7
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 +24 -24
- package/dist/unity.js +896 -883
- package/dist/unity.min.js +1 -1
- package/package.json +44 -39
package/dist/unity.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Unity=t()}(this,function(){"use strict";class e{constructor(e){this.gameObject=e}get position(){return this.#e("transform.getPosition","")}set position(e){this.#t(e),this.#e("transform.setPosition",e)}get localPosition(){return this.#e("transform.getLocalPosition","")}set localPosition(e){this.#t(e),this.#e("transform.setLocalPosition",e)}get rotation(){return this.#e("transform.getRotation","")}set rotation(e){this.#n(e),this.#e("transform.setRotation",e)}get eulerAngles(){return this.#e("transform.getEulerAngles","")}set eulerAngles(e){console.warn("[Unity] eulerAngles is read-only.")}get localScale(){return this.#e("transform.getLocalScale","")}set localScale(e){this.#t(e),this.#e("transform.setLocalScale",e)}get lossyScale(){return this.#e("transform.getLossyScale","")}set lossyScale(e){console.warn("[Unity] lossyScale is read-only.")}Translate(e,t,n){this.#e("transform.translate",{x:e,y:t,z:n})}Rotate(e,t,n){this.#e("transform.rotate",{x:e,y:t,z:n})}#e(e,t){return this.gameObject||console.error("[Unity] The GameObject associated with this Transform is null"),this.gameObject._invokeGameObjectEvent(e,t)}#t(e){if("object"!=typeof e||null===e||"number"!=typeof e.x||"number"!=typeof e.y||"number"!=typeof e.z)throw new Error(`[Unity] Invalid Vector3: ${JSON.stringify(e)}`)}#n(e){if("object"!=typeof e||null===e||"number"!=typeof e.x||"number"!=typeof e.y||"number"!=typeof e.z||"number"!=typeof e.w)throw new Error(`[Unity] Invalid Quaternion: ${JSON.stringify(e)}`)}}class t{constructor(e){this.gameObject=e}get mass(){return this.#e("physics.getMass","")}get useGravity(){return this.#e("physics.getUseGravity","")}get isKinematic(){return this.#e("physics.getIsKinematic","")}get linearDamping(){return this.#e("physics.getLinearDamping","")}get angularDamping(){return this.#e("physics.getAngularDamping","")}AddForce(e,t,n){this.#e("physics.addForce",{x:e,y:t,z:n})}AddTorque(e,t,n){this.#e("physics.addTorque",{x:e,y:t,z:n})}SetVelocity(e,t,n){this.#e("physics.setVelocity",{x:e,y:t,z:n})}GetVelocity(){return this.#e("physics.getVelocity","")}SetAngularVelocity(e,t,n){this.#e("physics.setAngularVelocity",{x:e,y:t,z:n})}GetAngularVelocity(){return this.#e("physics.getAngularVelocity","")}SetUseGravity(e){this.#e("physics.setUseGravity",e)}SetIsKinematic(e){this.#e("physics.setIsKinematic",e)}SetMass(e){this.#e("physics.setMass",e)}SetLinearDamping(e){this.#e("physics.setLinearDamping",e)}#e(e,t){return this.gameObject?this.gameObject._invokeGameObjectEvent(e,t):(console.error("[Unity] The GameObject associated with this RigidBody is null"),null)}}class n{#s=null;#a=null;static keyGameObjects={};static#i={awake:{},start:{},update:{},enable:{},disable:{},destroy:{}};static GetKeyGameObject(e){return n.keyGameObjects.hasOwnProperty(e)?n.keyGameObjects[e]:(console.error(`GameObject with key '${e}' not found`),null)}static Instantiate(t,s={x:0,y:0,z:0},a={x:0,y:0,z:0,w:1},i=null){if(null===i)Unity.InvokeEvent("InstanceEvent:InstantiateGameObject",{prefabPath:t,position:s,rotation:a});else{const r=i instanceof n?i:i instanceof e?i.gameObject:null;if(null===r)return;r.Instantiate(t,s,a)}}static onAwake(e,t){n.#i.awake.hasOwnProperty(e)||(n.#i.awake[e]=new Set),n.#i.awake[e].add(t)}static onStart(e,t){n.#i.start.hasOwnProperty(e)||(n.#i.start[e]=new Set),n.#i.start[e].add(t)}static onUpdate(e,t){n.#i.update.hasOwnProperty(e)||(n.#i.update[e]=new Set),n.#i.update[e].add(t)}static onEnable(e,t){n.#i.enable.hasOwnProperty(e)||(n.#i.enable[e]=new Set),n.#i.enable[e].add(t)}static onDisable(e,t){n.#i.disable.hasOwnProperty(e)||(n.#i.disable[e]=new Set),n.#i.disable[e].add(t)}static onDestroy(e,t){n.#i.destroy.hasOwnProperty(e)||(n.#i.destroy[e]=new Set),n.#i.destroy[e].add(t)}static _register(e,t){n.keyGameObjects[e]=new n(e,t)}static _receiveLifeCycleEvent(e,t){const s=n.keyGameObjects[e];if(!s)return;const a=n.#i[t][e];if(a)for(const e of a)e(s);"destroy"===t&&delete n.keyGameObjects[e]}constructor(n,s){this.key=n,this.name=s.name,this.#s=new e(this),s.hasRigidbody&&(this.#a=new t(this)),this.hierarchyPath=s.hasOwnProperty("hierarchyPath")?s.hierarchyPath:""}get transform(){return this.#s}get rigidbody(){return this.HasComponent("Rigidbody")?(this.#a=new t(this),this.#a):null}SetActive(e){this?._invokeGameObjectEvent("gameObject.setActive",e)}InvokeMethod(e,t="",n=""){t=Unity.types[t]||t,this?._invokeGameObjectEvent("gameObject.invokeMethod",{methodName:e,parameterType:t,parameterValue:n})}GetChild(e){const t="string"==typeof e?"gameObject.findChild":"gameObject.getChild",s=this?._invokeGameObjectEvent(t,e);if(null!==s){const e=""===this.hierarchyPath?this.key:this.hierarchyPath;return s.hierarchyPath=e+"/"+s.name,new n(this.key,s)}return null}SetText(e){this?._invokeGameObjectEvent("text.setText",e)}Destroy(){this?._invokeGameObjectEvent("gameObject.destroy","")}Instantiate(e,t={x:0,y:0,z:0},n={x:0,y:0,z:0,w:1}){this?._invokeGameObjectEvent("gameObject.instantiate",{prefabPath:e,position:t,rotation:n})}HasComponent(e){return this?._invokeGameObjectEvent("gameObject.hasComponent",e)}GetComponent(e){return this?._invokeGameObjectEvent("gameObject.getComponent",e)}AddComponent(e){return this?._invokeGameObjectEvent("gameObject.addComponent",e)}_invokeGameObjectEvent(e,t){let n=t;"object"==typeof t?n=JSON.stringify(t):"string"!=typeof t&&(n=t.toString());const s={eventName:e,hierarchyPath:this.hierarchyPath,payloadJson:n,listenDisabled:!0},a=Unity.InvokeEvent(`GOEvent:${this.key}`,JSON.stringify(s));if(Unity.internalLogs&&console.log(`Invoked Event: GOEvent:${this.key}`,s),null===a||!a.hasOwnProperty("ok"))return console.error(`Invalid JSON response from GameObject event callback: ${a}`),null;if(a.ok){let e=a.responseJson;try{e=JSON.parse(a.responseJson)}catch{}return e}return console.error(`Error invoking GameObject event: ${e}`,a.error),null}}class s{static get time(){return Unity.InvokeEvent("InstanceEvent:GetTime")}static get deltaTime(){return Unity.InvokeEvent("InstanceEvent:GetDeltaTime")}static get fixedDeltaTime(){return Unity.InvokeEvent("InstanceEvent:GetFixedDeltaTime")}static get unscaledDeltaTime(){return Unity.InvokeEvent("InstanceEvent:GetUnscaledDeltaTime")}static get realtimeSinceStartup(){return Unity.InvokeEvent("InstanceEvent:GetRealtimeSinceStartup")}static get timeScale(){return Unity.InvokeEvent("InstanceEvent:GetTimeScale")}static set timeScale(e){Unity.InvokeEvent("InstanceEvent:SetTimeScale",e)}}return class e{static GameObject=n;static Time=s;static internalLogs=!1;static types={int:"System.Int32",float:"System.Single",double:"System.Double",bool:"System.Boolean",string:"System.String",char:"System.Char",byte:"System.Byte",long:"System.Int64",short:"System.Int16",decimal:"System.Decimal",object:"System.Object",customClass:(e,t="",n="Assembly-CSharp")=>`${""===t?e:`${t}.${e}`}, ${n}.dll`};static#r;static#o=!1;static#c=new Set;static#l={};static LoadInstance(t,n){e.#o=!1;const s=new XMLHttpRequest;s.open("GET",t+"/index.html",!0),s.onreadystatechange=function(){if(4!==s.readyState||200!==s.status)return;document.querySelector(`#${n}`).innerHTML=s.responseText;const e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=t+"/TemplateData/style.css",document.head.appendChild(e);const a=document.createElement("script");a.src=t+"/index.js",document.body.appendChild(a)},s.send()}static GetVersion(){return e.InvokeEvent("InstanceEvent:GetUnityVersion")}static GetBuildVersion(){return e.InvokeEvent("InstanceEvent:GetBuildVersion")}static InvokeEvent(t,n=void 0){const s=e.#y(t,n);try{const n=JSON.parse(s);return n.hasOwnProperty("promiseId")&&(console.warn(`Event '${t}' returned a promise. Consider using InvokeEventAsync instead.`),e.onEvent(`PromiseResolvedEvent:${n.promiseId}`,t=>{delete e.#l[`PromiseResolvedEvent:${n.promiseId}`]})),n}catch{return s}}static async InvokeEventAsync(t,n=void 0){return new Promise(s=>{const a=e.#y(t,n);try{const t=JSON.parse(a);t.hasOwnProperty("promiseId")?e.onEvent(`PromiseResolvedEvent:${t.promiseId}`,n=>{s(n),delete e.#l[`PromiseResolvedEvent:${t.promiseId}`]}):s(t)}catch{s(a)}})}static async WaitForEndOfFrameAsync(){return new Promise(t=>{const n=crypto.randomUUID().toString(),s=`EndOfFrameEvent:${n}`;e.onEvent(s,()=>{t(),delete e.#l[s]}),e.InvokeEvent("InstanceEvent:WaitForEndOfFrame",n)})}static async LoadSceneAsync(t){return new Promise(n=>{const s=`SceneLoadedEvent:${t}`;e.onEvent(s,()=>{n(),delete e.#l[s]}),e.InvokeEvent("InstanceEvent:LoadScene",t)})}static IsSceneLoading(){return e.InvokeEvent("InstanceEvent:IsSceneLoading")}static GetSceneLoadProgress(){return e.InvokeEvent("InstanceEvent:GetSceneLoadProgress")}static async LoadBundleAsync(t){await e.InvokeEventAsync("InstanceEvent:LoadBundle",t)}static async InstantiatePrefabFromBundleAsync(t,n,s=""){await e.InvokeEventAsync("InstanceEvent:InstantiatePrefabFromBundle",{bundleUrl:t,prefabName:n,parentKey:s})}static onInstanceReady(t){e.#o?t():e.#c.add(t)}static onEvent(t,n){e.#l.hasOwnProperty(t)||(e.#l[t]=new Set),e.#l[t].add(n)}static offEvent(t,n){e.#l.hasOwnProperty(t)&&e.#l[t].delete(n)}static#y(t,n){null==n&&(n="");let s=n;"object"==typeof n?s=JSON.stringify(n):"string"!=typeof n&&(s=n.toString());const a=e.#r(t,s);return e.#l[t]?.forEach(e=>e(s)),a}static _instanceReady(){e.#o=!0,e.#c.forEach(e=>e())}static _registerClientListener(t){e.#r=t}static _receiveEvent(t,n){let s=n;try{s=JSON.parse(n)}catch{}e.InvokeEvent(t,s)}static _logFromUnity(t,n){("internal"!==t||e.internalLogs)&&("error"===t?console.error(`[Unity] ${n}`):"warning"===t?console.warn(`[Unity] ${n}`):console.log(`[Unity] ${n}`))}}});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Unity=t()}(this,function(){"use strict";class e{constructor(e){this.gameObject=e}get position(){return this.#e("transform.getPosition","")}set position(e){this.#t(e),this.#e("transform.setPosition",e)}get localPosition(){return this.#e("transform.getLocalPosition","")}set localPosition(e){this.#t(e),this.#e("transform.setLocalPosition",e)}get rotation(){return this.#e("transform.getRotation","")}set rotation(e){this.#n(e),this.#e("transform.setRotation",e)}get eulerAngles(){return this.#e("transform.getEulerAngles","")}set eulerAngles(e){console.warn("[Unity] eulerAngles is read-only.")}get localScale(){return this.#e("transform.getLocalScale","")}set localScale(e){this.#t(e),this.#e("transform.setLocalScale",e)}get lossyScale(){return this.#e("transform.getLossyScale","")}set lossyScale(e){console.warn("[Unity] lossyScale is read-only.")}Translate(e,t,n){this.#e("transform.translate",{x:e,y:t,z:n})}Rotate(e,t,n){this.#e("transform.rotate",{x:e,y:t,z:n})}#e(e,t){return this.gameObject||console.error("[Unity] The GameObject associated with this Transform is null"),this.gameObject._invokeGameObjectEvent(e,t)}#t(e){if("object"!=typeof e||null===e||"number"!=typeof e.x||"number"!=typeof e.y||"number"!=typeof e.z)throw new Error(`[Unity] Invalid Vector3: ${JSON.stringify(e)}`)}#n(e){if("object"!=typeof e||null===e||"number"!=typeof e.x||"number"!=typeof e.y||"number"!=typeof e.z||"number"!=typeof e.w)throw new Error(`[Unity] Invalid Quaternion: ${JSON.stringify(e)}`)}}class t{constructor(e){this.gameObject=e}get mass(){return this.#e("physics.getMass","")}get useGravity(){return this.#e("physics.getUseGravity","")}get isKinematic(){return this.#e("physics.getIsKinematic","")}get linearDamping(){return this.#e("physics.getLinearDamping","")}get angularDamping(){return this.#e("physics.getAngularDamping","")}AddForce(e,t,n){this.#e("physics.addForce",{x:e,y:t,z:n})}AddTorque(e,t,n){this.#e("physics.addTorque",{x:e,y:t,z:n})}SetVelocity(e,t,n){this.#e("physics.setVelocity",{x:e,y:t,z:n})}GetVelocity(){return this.#e("physics.getVelocity","")}SetAngularVelocity(e,t,n){this.#e("physics.setAngularVelocity",{x:e,y:t,z:n})}GetAngularVelocity(){return this.#e("physics.getAngularVelocity","")}SetUseGravity(e){this.#e("physics.setUseGravity",e)}SetIsKinematic(e){this.#e("physics.setIsKinematic",e)}SetMass(e){this.#e("physics.setMass",e)}SetLinearDamping(e){this.#e("physics.setLinearDamping",e)}#e(e,t){return this.gameObject?this.gameObject._invokeGameObjectEvent(e,t):(console.error("[Unity] The GameObject associated with this RigidBody is null"),null)}}class n{#s=null;#a=null;#i=null;static keyGameObjects={};static#r={awake:{},start:{},update:{},enable:{},disable:{},destroy:{}};static GetKeyGameObject(e){if(!n.keyGameObjects.hasOwnProperty(e)){const t=Unity.InvokeEvent("InstanceEvent:GetKeyGameObject",e);if(!t)return console.error(`GameObject with key '${e}' not found`),null;n.keyGameObjects[e]=new n(e,t)}return n.keyGameObjects[e]}static Instantiate(t,s={x:0,y:0,z:0},a={x:0,y:0,z:0,w:1},i=null){if(null===i)Unity.InvokeEvent("InstanceEvent:InstantiateGameObject",{prefabPath:t,position:s,rotation:a});else{const r=i instanceof n?i:i instanceof e?i.gameObject:null;if(null===r)return;r.Instantiate(t,s,a)}}static onAwake(e,t){n.#r.awake.hasOwnProperty(e)||(n.#r.awake[e]=new Set),n.#r.awake[e].add(t)}static onStart(e,t){n.#r.start.hasOwnProperty(e)||(n.#r.start[e]=new Set),n.#r.start[e].add(t)}static onUpdate(e,t){n.#r.update.hasOwnProperty(e)||(n.#r.update[e]=new Set),n.#r.update[e].add(t)}static onEnable(e,t){n.#r.enable.hasOwnProperty(e)||(n.#r.enable[e]=new Set),n.#r.enable[e].add(t)}static onDisable(e,t){n.#r.disable.hasOwnProperty(e)||(n.#r.disable[e]=new Set),n.#r.disable[e].add(t)}static onDestroy(e,t){n.#r.destroy.hasOwnProperty(e)||(n.#r.destroy[e]=new Set),n.#r.destroy[e].add(t)}static _register(e,t){n.keyGameObjects[e]=new n(e,t)}static _receiveLifeCycleEvent(e,t){const s=n.keyGameObjects[e];if(!s)return;const a=n.#r[t][e];if(a)for(const e of a)e(s);"destroy"===t&&delete n.keyGameObjects[e]}constructor(n,s,a=null){this.key=n,this.name=s.name,this.#i=a||this,this.#s=new e(this),s.hasRigidbody&&(this.#a=new t(this)),this.hierarchyPath=s.hasOwnProperty("hierarchyPath")?s.hierarchyPath:""}get transform(){return this.#s}get rigidbody(){return this.HasComponent("Rigidbody")?(this.#a=new t(this),this.#a):null}SetActive(e){this?._invokeGameObjectEvent("gameObject.setActive",e)}InvokeMethod(e,t="",n=""){t=Unity.types[t]||t,this?._invokeGameObjectEvent("gameObject.invokeMethod",{methodName:e,parameterType:t,parameterValue:n})}GetChild(e){const t="string"==typeof e?"gameObject.findChild":"gameObject.getChild",s=this?._invokeGameObjectEvent(t,e);if(null!==s){const e=""===this.hierarchyPath?this.key:this.hierarchyPath;return s.hierarchyPath=e+"/"+s.name,new n(this.key,s,this.#i)}return null}SetText(e){this?._invokeGameObjectEvent("text.setText",e)}Destroy(){this?._invokeGameObjectEvent("gameObject.destroy","")}Instantiate(e,t={x:0,y:0,z:0},n={x:0,y:0,z:0,w:1}){this?._invokeGameObjectEvent("gameObject.instantiate",{prefabPath:e,position:t,rotation:n})}HasComponent(e){return this?._invokeGameObjectEvent("gameObject.hasComponent",e)}GetComponent(e){return this?._invokeGameObjectEvent("gameObject.getComponent",e)}AddComponent(e){return this?._invokeGameObjectEvent("gameObject.addComponent",e)}_invokeGameObjectEvent(e,t){if(n.keyGameObjects[this.key]!==this.#i)return console.error(`Attempted to invoke event '${e}' on a stale GameObject reference (Key: ${this.key}, Path: ${this.hierarchyPath}). This object has been destroyed or replaced.`),null;let s=t;"object"==typeof t?s=JSON.stringify(t):"string"!=typeof t&&(s=t.toString());const a={eventName:e,hierarchyPath:this.hierarchyPath,payloadJson:s,listenDisabled:!0},i=Unity.InvokeEvent(`GOEvent:${this.key}`,JSON.stringify(a));if(Unity.internalLogs&&console.log(`Invoked Event: GOEvent:${this.key}`,a),null===i||!i.hasOwnProperty("ok"))return console.error(`Invalid JSON response from GameObject event callback: ${i}`),null;if(i.ok){let e=i.responseJson;try{e=JSON.parse(i.responseJson)}catch{}return e}return console.error(`Error invoking GameObject event: ${e}`,i.error),null}}class s{static get time(){return Unity.InvokeEvent("InstanceEvent:GetTime")}static get deltaTime(){return Unity.InvokeEvent("InstanceEvent:GetDeltaTime")}static get fixedDeltaTime(){return Unity.InvokeEvent("InstanceEvent:GetFixedDeltaTime")}static get unscaledDeltaTime(){return Unity.InvokeEvent("InstanceEvent:GetUnscaledDeltaTime")}static get realtimeSinceStartup(){return Unity.InvokeEvent("InstanceEvent:GetRealtimeSinceStartup")}static get timeScale(){return Unity.InvokeEvent("InstanceEvent:GetTimeScale")}static set timeScale(e){Unity.InvokeEvent("InstanceEvent:SetTimeScale",e)}}return class e{static GameObject=n;static Time=s;static internalLogs=!1;static types={int:"System.Int32",float:"System.Single",double:"System.Double",bool:"System.Boolean",string:"System.String",char:"System.Char",byte:"System.Byte",long:"System.Int64",short:"System.Int16",decimal:"System.Decimal",object:"System.Object",customClass:(e,t="",n="Assembly-CSharp")=>`${""===t?e:`${t}.${e}`}, ${n}.dll`};static#o;static#c=!1;static#l=new Set;static#y={};static LoadInstance(t,n){e.#c=!1;const s=new XMLHttpRequest;s.open("GET",t+"/index.html",!0),s.onreadystatechange=function(){if(4!==s.readyState||200!==s.status)return;document.querySelector(`#${n}`).innerHTML=s.responseText;const e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=t+"/TemplateData/style.css",document.head.appendChild(e);const a=document.createElement("script");a.src=t+"/index.js",document.body.appendChild(a)},s.send()}static GetVersion(){return e.InvokeEvent("InstanceEvent:GetUnityVersion")}static GetBuildVersion(){return e.InvokeEvent("InstanceEvent:GetBuildVersion")}static InvokeEvent(t,n=void 0){const s=e.#v(t,n);try{const n=JSON.parse(s);return n.hasOwnProperty("promiseId")&&(console.warn(`Event '${t}' returned a promise. Consider using InvokeEventAsync instead.`),e.onEvent(`PromiseResolvedEvent:${n.promiseId}`,t=>{delete e.#y[`PromiseResolvedEvent:${n.promiseId}`]})),n}catch{return s}}static async InvokeEventAsync(t,n=void 0){return new Promise(s=>{const a=e.#v(t,n);try{const t=JSON.parse(a);t.hasOwnProperty("promiseId")?e.onEvent(`PromiseResolvedEvent:${t.promiseId}`,n=>{s(n),delete e.#y[`PromiseResolvedEvent:${t.promiseId}`]}):s(t)}catch{s(a)}})}static async WaitForEndOfFrameAsync(){return new Promise(t=>{const n=crypto.randomUUID().toString(),s=`EndOfFrameEvent:${n}`;e.onEvent(s,()=>{t(),delete e.#y[s]}),e.InvokeEvent("InstanceEvent:WaitForEndOfFrame",n)})}static async LoadSceneAsync(t){return new Promise(n=>{const s=`SceneLoadedEvent:${t}`;e.onEvent(s,()=>{n(),delete e.#y[s]}),e.InvokeEvent("InstanceEvent:LoadScene",t)})}static IsSceneLoading(){return e.InvokeEvent("InstanceEvent:IsSceneLoading")}static GetSceneLoadProgress(){return e.InvokeEvent("InstanceEvent:GetSceneLoadProgress")}static async LoadBundleAsync(t){await e.InvokeEventAsync("InstanceEvent:LoadBundle",t)}static async InstantiatePrefabFromBundleAsync(t,n,s=""){await e.InvokeEventAsync("InstanceEvent:InstantiatePrefabFromBundle",{bundleUrl:t,prefabName:n,parentKey:s})}static onInstanceReady(t){e.#c?t():e.#l.add(t)}static onEvent(t,n){e.#y.hasOwnProperty(t)||(e.#y[t]=new Set),e.#y[t].add(n)}static offEvent(t,n){e.#y.hasOwnProperty(t)&&e.#y[t].delete(n)}static#v(t,n){null==n&&(n="");let s=n;"object"==typeof n?s=JSON.stringify(n):"string"!=typeof n&&(s=n.toString());const a=e.#o(t,s);return e.#y[t]?.forEach(e=>e(s)),a}static _instanceReady(){e.#c=!0,e.#l.forEach(e=>e())}static _registerClientListener(t){e.#o=t}static _receiveEvent(t,n){let s=n;try{s=JSON.parse(n)}catch{}e.InvokeEvent(t,s)}static _logFromUnity(t,n){("internal"!==t||e.internalLogs)&&("error"===t?console.error(`[Unity] ${n}`):"warning"===t?console.warn(`[Unity] ${n}`):console.log(`[Unity] ${n}`))}}});
|
package/package.json
CHANGED
|
@@ -1,39 +1,44 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pizzapopcorn/unijs",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"unity",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@pizzapopcorn/unijs",
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"//": "PLEASE DO NOT MANUALLY MODIFY THE VERSION. Use the automatic bump workflow.",
|
|
5
|
+
"description": "A seamless interop layer to control Unity WebGL builds from the browser's JavaScript context.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"unijs",
|
|
9
|
+
"unityjs",
|
|
10
|
+
"unity.js",
|
|
11
|
+
"unity",
|
|
12
|
+
"uni",
|
|
13
|
+
"js",
|
|
14
|
+
"javascript",
|
|
15
|
+
"interop",
|
|
16
|
+
"web",
|
|
17
|
+
"webgl"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://github.com/PizzaPopcorn/unijs-lib#readme",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/PizzaPopcorn/unijs-lib/issues"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/PizzaPopcorn/unijs-lib.git"
|
|
26
|
+
},
|
|
27
|
+
"author": "Andres Urrutia <urrutiac.andres@gmail.com> (https://portfolio.sharpdevmx.com)",
|
|
28
|
+
"type": "module",
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public",
|
|
31
|
+
"registry": "https://registry.npmjs.org/"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
35
|
+
"rollup": "^4.59.0"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "rollup -c",
|
|
39
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist"
|
|
43
|
+
]
|
|
44
|
+
}
|