JavaScript Mapping for Local Classes

On this page:

Mapped JavaScript Class

A local Slice class is mapped to a JavaScript class with the same name. For example:

Slice
module M
{
    local class Example
    {
        ...
    }
}

is mapped to the JavaScript class Example:

JavaScript
class Example
{
    ...
};

LocalObject in JavaScript

Local Slice classes implicitly derive from LocalObject, which is mapped to the native Object class in JavaScript.

Mapping for Local Interface Inheritance in JavaScript

A local Slice class can extend another local Slice class, and can implement one or more local Slice interfaces. extends is mapped to class inheritance in JavaScript, but implements is not mapped. For example:

Slice
module M
{
    local interface A {}
    local interface B {}
    
    local class C implements A, B {}
    local class D extends C {}
}

is mapped to:

JavaScript
// No mapping for A or B
class C
{
    ...
};
class D extends C
{
    ...
};