compassjs 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,2 +1,5 @@
1
+ == 0.1.1 (Ferdinand Magellan)
2
+ * Fix GPS hack detection on Nexus 4.
3
+
1
4
  == 0.1 (James Cook)
2
5
  * Initial release.
data/README.md CHANGED
@@ -109,9 +109,9 @@ For Ruby on Rails you can use gem for Assets Pipeline.
109
109
  If you don’t use any assets packaging manager (it’s very bad idea), you can use
110
110
  already minified version of the library.
111
111
 
112
- Take it from: [github.com/ai/compass.js/downloads].
112
+ Take it from: [ai.github.com/compass.js/compass.js].
113
113
 
114
- [github.com/ai/compass.js/downloads]: https://github.com/ai/compass.js/downloads
114
+ [ai.github.com/compass.js/compass.js]: http://ai.github.com/compass.js/compass.js
115
115
 
116
116
  ## Contributing
117
117
 
@@ -234,10 +234,11 @@
234
234
  self._start('phonegap');
235
235
 
236
236
  } else if ( self._win.DeviceOrientationEvent ) {
237
+ self._checking = 0;
237
238
  self._win.addEventListener('deviceorientation', self._checkEvent);
238
239
  setTimeout(function () {
239
- if ( !self._checked ) {
240
- self._start(false)
240
+ if ( self._checking !== false ) {
241
+ self._start(false);
241
242
  }
242
243
  }, 500);
243
244
 
@@ -296,12 +297,13 @@
296
297
  self._callbacks.noSupport = [];
297
298
  },
298
299
 
299
- // Tell, that `DeviceOrientationEvent` was fired.
300
- _checked: undefined,
300
+ // Tell, that we wait for `DeviceOrientationEvent`.
301
+ _checking: false,
301
302
 
302
303
  // Check `DeviceOrientationEvent` to detect compass method.
303
304
  _checkEvent: function (e) {
304
- self._checked = true;
305
+ self._checking += 1;
306
+ var wait = false;
305
307
 
306
308
  if ( defined(e.webkitCompassHeading) ) {
307
309
  self._start('webkitOrientation');
@@ -309,11 +311,17 @@
309
311
  } else if ( defined(e.alpha) && self._nav.geolocation ) {
310
312
  self._gpsHack();
311
313
 
312
- } else {
314
+ } else if ( self._checking > 1 ) {
313
315
  self._start(false);
316
+
317
+ } else {
318
+ wait = true;
314
319
  }
315
320
 
316
- self._win.removeEventListener('deviceorientation', self._checkEvent);
321
+ if ( !wait ) {
322
+ self._checking = false;
323
+ self._win.removeEventListener('deviceorientation', self._checkEvent);
324
+ }
317
325
  },
318
326
 
319
327
  // Use GPS to detect difference between `alpha` orientation and real North.
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: compassjs
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andrey "A.I." Sitnik
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-27 00:00:00.000000000 Z
12
+ date: 2013-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  type: :runtime
@@ -43,7 +43,7 @@ files:
43
43
  - LICENSE
44
44
  - README.md
45
45
  - ChangeLog
46
- homepage: https://github.com/ai/compass.js
46
+ homepage: http://ai.github.com/compass.js/
47
47
  licenses: []
48
48
  post_install_message:
49
49
  rdoc_options: []