UNPKG

@nent/core

Version:

Functional elements to add routing, data-binding, dynamic HTML, declarative actions, audio, video, and so much more. Supercharge static HTML files into web apps without script or builds.

4 lines 1.2 kB
/*! * NENT 2022 */ import{r as s,h as t,a as i,H as a}from"./index-916ca544.js";import{a as o}from"./index-f7016b94.js";import{a as n,L as r,D as c,c as e}from"./interfaces-13ff7aec.js";import{s as h,o as d}from"./state-627a24e0.js";import{f as m}from"./logging-5a93c8af.js";import"./index-4bfabbbd.js";const l=class{constructor(t){s(this,t),this.sent=!1,this.mode="queue",this.discard="route",this.loop=!1,this.deferLoad=!1}async getAction(){return{topic:n,command:this.mode||r.load,data:{trackId:this.trackId||this.src,src:this.src,discard:this.discard||c.route,loop:this.loop,type:e.music,mode:this.mode||r.load}}}async sendAction(s){const t=await this.getAction();s&&Object.assign(t.data,s),h.hasAudioComponent?o.emit(t.topic,t):this.dispose=d("hasAudioComponent",(async s=>{var i;s&&(o.emit(t.topic,t),m(h.debug,`n-audio-action-music-load: load-action sent for ${this.trackId}`),this.sent=!0),null===(i=this.dispose)||void 0===i||i.call(this)}))}async componentWillRender(){this.deferLoad||this.sent||await this.sendAction()}render(){return t(a,null)}disconnectedCallback(){var s;null===(s=this.dispose)||void 0===s||s.call(this)}get el(){return i(this)}};export{l as n_audio_action_music_load}