unity-webgl
Version:
Unity-WebGL provides an easy solution for embedding Unity WebGL builds in your web projects, with two-way communication between your webApp and Unity application with advanced API's.
8 lines (7 loc) • 1.15 kB
JavaScript
/*!
* unity-webgl v4.4.2
* Copyright (c) 2025 Mariner<mengqing723@gmail.com>
* Released under the Apache-2.0 License.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue-demi")):"function"==typeof define&&define.amd?define(["vue-demi"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VueUnity=t(e.VueDemi)}(this,(function(e){"use strict";let t=0;function n(e){return isNaN(e)?e:e+"px"}return e.defineComponent({name:"UnityWebglComponent",props:{unity:{type:Object},width:{type:[String,Number],default:"100%"},height:{type:[String,Number],default:"100%"},tabindex:{type:[Number,String]}},setup(i){const u=e.ref(null);t++;const o=e.computed((()=>({width:n(i.width),height:n(i.height)}))),d={id:`unity-canvas-${t}`};return(i.tabindex||0===i.tabindex)&&(d.tabindex=i.tabindex),e.onMounted((()=>{var e;u.value&&(null===(e=i.unity)||void 0===e||e.render(u.value))})),e.onBeforeUnmount((()=>{var e;null===(e=i.unity)||void 0===e||e.unsafe_unload()})),()=>e.h("canvas",e.isVue2?{ref:u,attrs:d,style:o.value}:Object.assign({ref:u,style:o.value},d))}})}));
//# sourceMappingURL=vue.min.js.map