Skip to content

Commit

Permalink
Removed getter from near, max, min, value attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres-remote committed May 22, 2012
1 parent 736f48d commit 3fb55a2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
43 changes: 20 additions & 23 deletions DeviceProximityEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* This program implements the following intefaces:
*
* [Constructor (DOMString type, optional DeviceProximityEventInit eventInitDict)]
* [Constructor(DOMString type,optional DeviceProximityEventInit eventInitDict)]
* interface DeviceProximityEvent : Event {
* readonly attribute double value;
* readonly attribute double min;
Expand All @@ -23,12 +23,11 @@
'use strict';
var min, max, value, props, iProtoObj,
//interface object + constructor
iObj = function DeviceProximityEvent(type, eventInitDict) {
iObj = function DeviceProximityEvent(type, eventInitDict) {
if (arguments.length === 0) {
throw new TypeError('Not Enough Arguments');
}
var props,
converters = Object.create({}),
var props, converters = Object.create({}),
dict = {
value: sensor.value || +Infinity,
max: sensor.max || +Infinity,
Expand All @@ -49,9 +48,7 @@
eventInitDict = Object(eventInitDict);
for (var key in eventInitDict) {
if (dict.hasOwnProperty(key)) {
var value,
idlValue,
converter = converters[key];
var value, idlValue, converter = converters[key];

if (HasProperty(eventInitDict, key)) {
value = eventInitDict[key];
Expand All @@ -68,29 +65,26 @@

//create the min attribute
props = {
get: function() {
return dict.min;
},
value: dict.min,
writable: false,
enumerable: true,
configurable: true
};
Object.defineProperty(event, 'min', props);

//create the max attribute
props = {
get: function() {
return dict.max;
},
value: dict.max,
writable: false,
enumerable: true,
configurable: true
};
Object.defineProperty(event, 'max', props);

//create the value attribute
props = {
get: function() {
return dict.value;
},
value: dict.value,
writable: false,
enumerable: true,
configurable: true
};
Expand Down Expand Up @@ -233,16 +227,19 @@
return Math.round(this.max * Math.random());
}, get near() {
return Boolean(this.value);
},
sense: function sense() {
var event,
dict;
obj = this;
}, sense: function sense() {
var event, dict;
obj = this;
setInterval(function() {
dict = {min: obj.min, max: obj.max, value: obj.value, near: obj.near};
dict = {
min: obj.min,
max: obj.max,
value: obj.value,
near: obj.near
};
event = new DeviceProximityEvent('deviceproximity', dict);
window.dispatchEvent(event);
},Math.round(2000 * Math.random() + 500));
}, Math.round(2000 * Math.random() + 500));
return this;
}
}.sense());
5 changes: 2 additions & 3 deletions UserProximityEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@

//add the near attribute
props = {
get: function() {
return dict.near;
},
value: dict.near,
writable: false,
enumerable: true,
configurable: true
};
Expand Down

0 comments on commit 3fb55a2

Please sign in to comment.