Confirmed users
19
edits
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
''This section is non-normative.'' | |||
The [[#DeviceMagneticFieldEvent_Interface|DeviceMagneticFieldEvent]] interface provides web developers information about the magnetic field near the hosting device. | |||
This is achieved by interrogating a magnetic field sensor or similar detectors of a device. | |||
=== Use cases === | === Use cases === | ||
== Conformance == | == Conformance == | ||
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative. | |||
The key words must, must not, required, should, should not, recommended, may, and optional in this specification are to be interpreted as described in [RFC2119]. | |||
This specification defines conformance criteria that apply to a single product: the '''''user agent''''' that implements the interfaces that it contains. | |||
== Terminology == | == Terminology == | ||
The [http://dev.w3.org/html5/spec/webappapis.html#eventhandler EventHandler] interface represents a [http://www.w3.org/TR/WebIDL/#idl-callback-functions callback function] used for [http://dev.w3.org/html5/spec/webappapis.html#event-handlers event handlers] as defined in [HTML5]. | |||
The concepts '''''[http://dev.w3.org/html5/spec/webappapis.html#queue-a-task queue a task]''''' and '''''[http://dev.w3.org/html5/spec/webappapis.html#fire-a-simple-event fires a simple event]''''' are defined in [HTML5]. | |||
The terms '''''[http://dev.w3.org/html5/spec/webappapis.html#event-handlers event handlers]''''' and '''''[http://dev.w3.org/html5/spec/webappapis.html#event-handler-event-type event handler event types]''''' are defined in [HTML5]. | |||
The concepts '''''[http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#constructing-events create an event]''''' and '''''[http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#firing-events fire an event]''''' are defined in [DOM4]. | |||
== Security and privacy considerations == | == Security and privacy considerations == | ||
== Magnetic Field == | == Magnetic Field == | ||
The HTML5 specification [HTML5] defines a [Window] interface, which this specification extends: | |||
partial interface Window { | |||
attribute EventHandler ondevicemagneticfield; | |||
}; | |||
=== Attributes === | === Attributes === | ||
'''ondevicemagneticfield''' of type EventHandler | |||
The ondevicemagneticfield event handler and its corresponding event handler event type devicemagneticfield must be supported as an IDL attribute by all objects implementing the Window interface. | |||
=== DeviceMagneticFieldEvent Interface === | === DeviceMagneticFieldEvent Interface === | ||
| Line 17: | Line 47: | ||
[Constructor (DOMString type, optional DeviceMagneticFieldEventInit eventInitDict)] | [Constructor (DOMString type, optional DeviceMagneticFieldEventInit eventInitDict)] | ||
interface DeviceMagneticFieldEvent : Event { | interface DeviceMagneticFieldEvent : Event { | ||
readonly attribute double x; | |||
readonly attribute double y; | |||
readonly attribute double z; | |||
}; | }; | ||
dictionary DeviceMagneticFieldEventInit : EventInit { | dictionary DeviceMagneticFieldEventInit : EventInit { | ||
double x; | |||
double y; | |||
double z; | |||
}; | }; | ||
| Line 52: | Line 82: | ||
==== Event handlers ==== | ==== Event handlers ==== | ||
== References == | The following are the [http://dev.w3.org/html5/spec/webappapis.html#event-handlers event handlers] (and their corresponding event handler event types) that must be supported as attributes by the Window object: | ||
{| | |||
| event handler || event handler event type | |||
|- | |||
| '''ondevicemagneticfield''' || devicemagneticfield | |||
|} | |||
== References == | |||
[DOM4] | |||
:Anne van Kesteren; Aryeh Gregor; Ms2ger. [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/ DOM4]. URL: http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/ | |||
[RFC2119] | |||
:S. Bradner. [http://www.ietf.org/rfc/rfc2119.txt Key words for use in RFCs to Indicate Requirement Levels.] March 1997. Internet RFC 2119. URL: http://www.ietf.org/rfc/rfc2119.txt | |||
[HTML5] | |||
:Ian Hickson; David Hyatt. [http://www.w3.org/TR/html5 HTML5]. 29 March 2012. W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/html5 | |||