Magnetic Field Events: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
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 x;
    readonly attribute double y;
    readonly attribute double y;
    readonly attribute double z;
    readonly attribute double z;
  };
  };


  dictionary DeviceMagneticFieldEventInit : EventInit {
  dictionary DeviceMagneticFieldEventInit : EventInit {
    double x;
    double x;
    double y;
    double y;
    double z;
    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

Revision as of 06:40, 22 November 2012

Introduction

This section is non-normative.

The 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

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

The EventHandler interface represents a callback function used for event handlers as defined in [HTML5].

The concepts queue a task and fires a simple event are defined in [HTML5].

The terms event handlers and event handler event types are defined in [HTML5].

The concepts create an event and fire an event are defined in [DOM4].

Security and privacy considerations

Magnetic Field

The HTML5 specification [HTML5] defines a [Window] interface, which this specification extends:

partial interface Window {
             attribute EventHandler ondevicemagneticfield;
};

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

[Constructor (DOMString type, optional DeviceMagneticFieldEventInit eventInitDict)]
interface DeviceMagneticFieldEvent : Event {
   readonly attribute double x;
   readonly attribute double y;
   readonly attribute double z;
};
dictionary DeviceMagneticFieldEventInit : EventInit {
   double x;
   double y;
   double z;
};

Attributes

x of type double, readonly

Ambient magnetic field in the X axis.

y of type double, readonly

Ambient magnetic field in the Y axis.

z of type double, readonly

Ambient magnetic field in the Z axis.

Dictionary DeviceMagneticFieldEventInit Members

x of type double

y of type double

z of type double

Event handlers

The following are the 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. DOM4. URL: http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/

[RFC2119]

S. Bradner. 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. HTML5. 29 March 2012. W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/html5