Vue.component('play-button', { props: ["state", "icon"], methods: { clicked: function() { this.$emit('click', {event: this.icon}); }, css() { let result = "play-button"; if (this.state == this.icon) { result += " player-active"; } return result; } }, template: `
` }); Vue.component('play-controls', { mounted: function() { this.request.startRequesting("entity/flecs/core/World"); }, beforeDestroy: function() { this.stopRequesting(); }, data: function() { return { state: undefined, request: new PeriodicRequest(100, this.on_recv_world, this.on_recv_err), data: undefined } }, methods: { play: function(e) { this.state = e.event; app.put("player/" + e.event, (msg) => { }); }, on_recv_world(data) { this.data = data; if (!this.state) { const state = this.data.data["flecs.player.Player"]; if (state.state == "EcsPlayerPlay") { this.state = "play"; } else if (state.state == "EcsPlayerStop") { this.state = "stop"; } else if (state.state == "EcsPlayerPause") { this.state = "pause"; } } }, on_recv_err() { this.state = undefined; } }, template: `
` });