Draft TC53-Draft / October 30, 2019

ECMAScript® Modules for Embedded Systems

Contributing to this Specification

This specification is developed on GitHub with the help of the ECMAScript community. There are a number of ways to contribute to the development of this specification:

Refer to the colophon for more information on how this document is created.

Introduction

This specification's source can be found at https://github.com/EcmaTC53/draft.

The ECMAScript Modules for Embedded Systems Specification (ECMA-nnn 1st Edition), provides key language sensitive functionality as a complement to the ECMAScript Language Specification (ECMA-262 10th Edition or successor). Its functionality has been selected from that of well-established Embedded Systems APIs.

NAME TBD
ECMA-nnn, 1st Edition Project Editor

1Scope

This Standard defines the application programming interface for ECMAScript modules that support programs that need to adapt to conventions used by different embedded systems.

2Conformance

A conforming implementation of the ECMAScript Modules for Embedded Systems Specification must conform to the ECMAScript Language Specification (ECMA-262 10th Edition, or successor), and must provide and support all the objects, properties, functions, and program semantics described in this specification.

A conforming implementation of the ECMAScript Modules for Embedded Systems Specification is permitted to provide additional objects, properties, and functions beyond those described in this specification. In particular, a conforming implementation of the ECMAScript Modules for Embedded Systems Specification is permitted to provide properties not described in this specification, and values for those properties, for objects that are described in this specification. A conforming implementation is not permitted to add optional arguments to the functions defined in this specification.

3Normative References

The following referenced documents are required for the application of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

ECMAScript Language Specification (ECMA-262 10th Edition, or successor).
https://www.ecma-international.org/publications/standards/Ecma-262.htm

Note
Throughout this document, the phrase “ES2020, x” (where x is a sequence of numbers separated by periods) may be used as shorthand for "ECMAScript Language Specification (ECMA-262 10th Edition, sub clause x)".

4Notational Conventions

This standard uses a subset of the notational conventions of the ECMAScript Language Specification (ECMA-262 10th Edition), as ES2020:

  • Object Internal Methods and Internal Slots, as described in ES2020, 6.1.7.2.
  • Algorithm conventions, including the use of abstract operations, as described in ES2020, 7.1, 7.2, 7.3.
  • Internal Slots, as described in ES2020, 9.1.
  • The List and Record Specification Type, as described in ES2020, 6.2.1.
Note
As described in the ECMAScript Language Specification, algorithms are used to precisely specify the required semantics of ECMAScript constructs, but are not intended to imply the use of any specific implementation technique. Internal slots are used to define the semantics of object values, but are not part of the API. They are defined purely for expository purposes. An implementation of the API must behave as if it produced and operated upon internal slots in the manner described here.

As an extension to the Record Specification Type, the notation “[[<name>]]” denotes a field whose name is given by the variable name, which must have a String value. For example, if a variable s has the value "a", then [[<s>]] denotes the field [[a]].

This specification uses blocks demarcated as Normative Optional to denote the sense of Annex B in ECMA-262. That is, normative optional sections are required when the ECMAScript host is a web browser. The content of the section is normative but optional if the ECMAScript host is not a web browser.

4.1Well-Known Intrinsic Objects

The following table extends the Well-Known Intrinsic Objects table defined in ES2020, 6.1.7.4.

Table 1: Well-known Intrinsic Objects (Extensions)
Intrinsic Name Global Name Node Reference Name ECMAScript Language Association
%Sensor% N/A Sensor The Sensor module object (6)
%PWM% N/A PWM The PWM module object (7)

5Requirements for Standard Built-in ECMAScript Objects

Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript Language Specification, 10th edition, clause 17, or successor.

6The Sensor Module Object

The Sensor Module Object is the %Sensor% intrinsic object and it's not a property in the global object. The Sensor Module Object is a single ordinary object.

The value of the [[Prototype]] internal slot of the Sensor Module Object is the intrinsic object %ObjectPrototype%.

The Sensor Module Object is not a function object. It does not have a [[Construct]] internal method; it is not possible to use the Sensor Module Object as a constructor with the new operator. The Sensor Module Object does not have a [[Call]] internal method; it is not possible to invoke the Sensor Module Object as a function.

6.1Function Properties of the Sensor Module Object

6.1.1Sensor.configure ( options )

When the configure function is called with argument options, the following steps are taken:

  1. If IsObject(options) is false, throw a TypeError exception.
  2. TODO: Set steps here
  3. Return undefined.

7The PWM Module Object

The PWM Module Object is the %PWM% intrinsic object and it's not a property in the global object. The PWM Module Object is a single ordinary object.

The value of the [[Prototype]] internal slot of the PWM Module Object is the intrinsic object %ObjectPrototype%.

The PWM Module Object is not a function object. It does not have a [[Construct]] internal method; it is not possible to use the PWM Module Object as a constructor with the new operator. The PWM Module Object does not have a [[Call]] internal method; it is not possible to invoke the PWM Module Object as a function.

7.1Function Properties of the PWM Module Object

7.1.1PWM.configure ( options )

When the configure function is called with argument options, the following steps are taken:

  1. If IsObject(options) is false, throw a TypeError exception.
  2. TODO: Set steps here
  3. Return undefined.

AColophon

This specification is authored on GitHub in a plaintext source format called Ecmarkup. Ecmarkup is an HTML and Markdown dialect that provides a framework and toolset for authoring ECMAScript specifications in plaintext and processing the specification into a full-featured HTML rendering that follows the editorial conventions for this document. Ecmarkup builds on and integrates a number of other formats and technologies including Grammarkdown for defining syntax and Ecmarkdown for authoring algorithm steps. PDF renderings of this specification are produced by printing the HTML rendering to a PDF.

BCopyright & Software License

Ecma International

Rue du Rhone 114

CH-1204 Geneva

Tel: +41 22 849 6000

Fax: +41 22 849 6001

Web: https://ecma-international.org/

Copyright Notice

© 2019 Ecma International

This draft document may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published, and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this section are included on all such copies and derivative works. However, this document itself may not be modified in any way, including by removing the copyright notice or references to Ecma International, except as needed for the purpose of developing any document or deliverable produced by Ecma International.

This disclaimer is valid only prior to final version of this document. After approval all rights on the standard are reserved by Ecma International.

The limited permissions are granted through the standardization phase and will not be revoked by Ecma International or its successors or assigns during this time.

This document and the information contained herein is provided on an "AS IS" basis and ECMA INTERNATIONAL DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Software License

All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the authors nor Ecma International may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.