Comments (6)
Agreed and we are also currently working on a native Promise-based API for this.
In the mean time, you could use a library like Full Tilt JS https://github.com/richtr/Full-Tilt-JS. It simply dumps the last DeviceOrientation event object to a variable until you call a sync API function in e.g. requestAnimationFrame. At that point it performs more complex processing of the last known device orientation data.
Full Tilt JS performance benchmarking is available at http://jsperf.com/screen-adjusted-deviceorientation-benchmark.
from deviceorientation.
Where is the work happening and who is involved? I tried looking for branches and PRs but couldn't find any.
from deviceorientation.
Our draft Promises proposal has now been published on the W3C Device APIs mailing list @ http://lists.w3.org/Archives/Public/public-device-apis/2014Sep/0024.html.
from deviceorientation.
It's definitely lacking. Alternatively or in addition, any thoughts on normalizing the spec for all browsers to star firing Device Orientation on the same time frame at the 'interactive' state of the document, so it can be used at or before DOMContentLoaded?
My related SO post as I was trying to detect this: http://stackoverflow.com/a/30585637/1647538
from deviceorientation.
Added label of VNext. This can be considered as part of Generic Sensor API work.
from deviceorientation.
I propose closing this issue as "won't fix". A Promise-returning API can easily be polyfilled like so,
function getCurrentOrientation() {
return new Promise((resolve) => {
document.addEventListener('deviceorientation', (event) => {
resolve(event);
}, {once: true});
});
}
The Observable proposal would also extend all EventTarget
s so that you could write:
let event = (await document.on('deviceorientation').take(1).toArray())[0];
from deviceorientation.
Related Issues (20)
- Broken references in DeviceOrientation Event Specification
- Behavior when event data cannot be provided is underspecified HOT 3
- DeviceOrientationEvent.absolute's value when data cannot be obtained
- Add automation support using WebDriver HOT 8
- Wide review tracker HOT 20
- Accessibility Checklist HOT 2
- Internationalization Checklist HOT 3
- Same origin S&P requirement conflicts with Permissions Policy integration HOT 3
- Guidance needed: how to acquire compass headings in a future-compatible manner? HOT 3
- "Status of this document" section needs to reflect join deliverable status HOT 8
- How to check when permission is denied? HOT 8
- Fix the build HOT 3
- Do we really need 3 permissions policies? HOT 7
- Abstract away underlying sensors HOT 2
- Fully active checks
- Alternative orientation representations? HOT 4
- Combined permission request is problematic HOT 6
- fire an orientation event need to use the dictionary HOT 1
- How reliable is interval? HOT 4
- Goodies from Accelerometer, Motion, Orientation, Gyro specs to bring over
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deviceorientation.