Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/feature/typo-proofing'
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Vergenz committed Dec 21, 2016
2 parents 4b67a7b + ac6f909 commit 9ee3314
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 7 deletions.
10 changes: 7 additions & 3 deletions dist/aframe-altspace-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,7 @@
* @property {string} gain Name of a state to add on the target
* @property {string} lose Name of a state to remove on the target
* @property {selector} targets A selector to pick which objects to wire to
* @property {selector} target - A selector to pick a single object to wire to
**/
AFRAME.registerComponent('wire',
{
Expand All @@ -1531,7 +1532,8 @@
lost: {type: 'string'},
gain: {type: 'string'},
lose: {type: 'string'},
targets: {type: 'selectorAll'}
targets: {type: 'selectorAll'},
target: {type: 'selector'}
},
update: function (oldData) {
if (oldData.on) {
Expand All @@ -1545,7 +1547,7 @@
}

this.actOnTargets = function () {
this.data.targets.forEach(function (el) {
function act(el) {
if (this.data.emit) {
el.emit(this.data.emit);
}
Expand All @@ -1555,7 +1557,9 @@
if (this.data.lose) {
el.removeState(this.data.lose);
}
}.bind(this));
}
this.data.targets.forEach(act.bind(this));
if(this.data.target) act.call(this, this.data.target);
}.bind(this);

this.actOnTargetsIfStateMatches = function (event) {
Expand Down
2 changes: 1 addition & 1 deletion dist/aframe-altspace-component.min.js

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions doc/wire.html
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,29 @@ <h5 class="subsection-title">Properties:</h5>
</tr>



<tr>

<td class="name"><code>target</code></td>


<td class="type">


<span class="param-type">selector</span>



</td>





<td class="description last"><p>A selector to pick a single object to wire to</p></td>
</tr>


</tbody>
</table>

Expand Down
10 changes: 7 additions & 3 deletions src/wire.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @property {string} gain Name of a state to add on the target
* @property {string} lose Name of a state to remove on the target
* @property {selector} targets A selector to pick which objects to wire to
* @property {selector} target - A selector to pick a single object to wire to
**/
AFRAME.registerComponent('wire',
{
Expand All @@ -19,7 +20,8 @@ AFRAME.registerComponent('wire',
lost: {type: 'string'},
gain: {type: 'string'},
lose: {type: 'string'},
targets: {type: 'selectorAll'}
targets: {type: 'selectorAll'},
target: {type: 'selector'}
},
update: function (oldData) {
if (oldData.on) {
Expand All @@ -33,7 +35,7 @@ AFRAME.registerComponent('wire',
}

this.actOnTargets = function () {
this.data.targets.forEach(function (el) {
function act(el) {
if (this.data.emit) {
el.emit(this.data.emit);
}
Expand All @@ -43,7 +45,9 @@ AFRAME.registerComponent('wire',
if (this.data.lose) {
el.removeState(this.data.lose);
}
}.bind(this));
}
this.data.targets.forEach(act.bind(this));
if(this.data.target) act.call(this, this.data.target);
}.bind(this);

this.actOnTargetsIfStateMatches = function (event) {
Expand Down

0 comments on commit 9ee3314

Please sign in to comment.