Skip to content

Commit

Permalink
Create navigate.js
Browse files Browse the repository at this point in the history
  • Loading branch information
philipnavidad committed Nov 11, 2017
1 parent 64a0b59 commit a5d084c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/aframe/dialog/navigate.js
@@ -0,0 +1,16 @@
AFRAME.registerComponent('navigate', {
schema: {
on: {type: 'string', default: 'click'},
link: {type: 'selector'}
},
init: function () {
this.el.addEventListener(this.data.on, function () {
if (this.data.link.href.indexOf('altspace://') === 0) {
this.data.link.click();
}
else {
altspace.open(this.data.link.href, '_blank');
}
}.bind(this));
}
});

0 comments on commit a5d084c

Please sign in to comment.