Skip to content

Commit

Permalink
Added Fake proximity sensor to UserProximityEvent.js and linted code.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres-remote committed May 20, 2012
1 parent c84e37d commit 78bd552
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
22 changes: 12 additions & 10 deletions DeviceProximityEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
This is an implementation of "Proximity Events":
http://dvcs.w3.org/hg/dap/raw-file/tip/proximity/Overview.html
Public Domain Software
To the extent possible under law, Marcos Caceres has waived all copyright and
related or neighboring rights to DeviceProximityEvent Implementation.
Public Domain Software
To the extent possible under law, Marcos Caceres has waived all copyright and
related or neighboring rights to DeviceProximityEvent Implementation.
This program implements the following intefaces:
Expand Down Expand Up @@ -76,8 +76,8 @@ dictionary DeviceProximityEventInit : EventInit {
});
//create the min attribute
props = {
get: function () {
return dict.min
get: function() {
return dict.min;
},
enumerable: true,
configurable: true
Expand All @@ -86,8 +86,8 @@ dictionary DeviceProximityEventInit : EventInit {

//create the max attribute
props = {
get: function () {
return dict.max
get: function() {
return dict.max;
},
enumerable: true,
configurable: true
Expand All @@ -96,8 +96,8 @@ dictionary DeviceProximityEventInit : EventInit {

//create the value attribute
props = {
get: function () {
return dict.value
get: function() {
return dict.value;
},
enumerable: true,
configurable: true
Expand Down Expand Up @@ -216,5 +216,7 @@ dictionary DeviceProximityEventInit : EventInit {
return 5.0;
}, get value() {
return Math.round(this.max * Math.random());
}, get near() {
return Boolean(this.value);
}
});
});
22 changes: 14 additions & 8 deletions UserProximityEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Implementation of "User Proximity"
http://dvcs.w3.org/hg/dap/raw-file/tip/proximity/userproximity.html
Public Domain Software
To the extent possible under law, Marcos Caceres has waived all copyright and
Public Domain Software
To the extent possible under law, Marcos Caceres has waived all copyright and
related or neighboring rights to DeviceProximityEvent Implementation.
This program implements the following intefaces:
This program implements the following intefaces:
[Constructor (DOMString type, optional UserProximityEventInit eventInitDict)]
interface UserProximityEvent : Event {
Expand Down Expand Up @@ -166,10 +166,16 @@ dictionary UserProximityEventInit : EventInit {
function UserProximityEvent() {

}
})(this,
//fake user proximity sensor
{
near: function() {
return Boolean(Math.round(Math.random()));
})(this,
//fake user proximity sensor
{
get min() {
return 0.2;
}, get max() {
return 5.0;
}, get value() {
return Math.round(this.max * Math.random());
}, get near() {
return Boolean(this.value);
}
});

0 comments on commit 78bd552

Please sign in to comment.