From 465bd632fc80578e35f649d30f03409604031cc9 Mon Sep 17 00:00:00 2001 From: joni <johnfshaughnessy@gmail.com> Date: Wed, 18 Apr 2018 14:51:10 -0700 Subject: [PATCH] Stub function for blocking on click --- src/components/block-button.js | 18 ++++++++++++++++++ src/hub.js | 1 + 2 files changed, 19 insertions(+) create mode 100644 src/components/block-button.js diff --git a/src/components/block-button.js b/src/components/block-button.js new file mode 100644 index 000000000..5ea1b9fb3 --- /dev/null +++ b/src/components/block-button.js @@ -0,0 +1,18 @@ +AFRAME.registerComponent("block-button", { + init() { + this.el.addEventListener("click", this.onClick); + const owner = (function getOwner(el) { + if (el.firstUpdateData) { + return el.firstUpdateData.owner; + } + if (el.parentEl) { + return getOwner(el.parentEl); + } + return null; + })(this.el); + + this.onClick = () => { + console.log("blockUser " + owner); + }; + } +}); diff --git a/src/hub.js b/src/hub.js index 9728c6217..562567375 100644 --- a/src/hub.js +++ b/src/hub.js @@ -53,6 +53,7 @@ import "./components/hud-controller"; import "./components/freeze-controller"; import "./components/icon-button"; import "./components/text-button"; +import "./components/block-button"; import "./components/visible-while-frozen"; import "./components/stats-plus"; -- GitLab