The tools are entirely experimental and evolving. There is no guarantee of they follow the proposed standard correctly.
public | private | |
---|---|---|
instance | public method | private method |
static | static method | static private method |
public | private | |
---|---|---|
instance | public getter public setter |
private getter private setter |
static | static getter static setter |
static private getter static private setter |
@decorator
class MyClass {}
-
value
is the class itself -
context
is an object with this content:
{
kind: "class",
name: "MyClass",
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class has been constructed. This function will receive as this
the
class.
-
undefined
, nothing is replaced -
a new class, it replaces the previous class which was passed as the first parameter
MyClass[Symbol.metadata][key].constructor
class MyClass {
@decorator
someMethod() {}
}
-
value
is the method itself -
context
is an object with this content:
{
kind: "method",
name: "someMethod",
isStatic: false,
isPrivate: false,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class is instantiated. This function will receive as this
the new
object.
-
undefined
, nothing is replaced -
a new function, it replaces the previous method which was passed as the first parameter
MyClass.prototype[Symbol.metadata][key].public.someMethod
class MyClass {
@decorator
static someMethod() {}
}
-
value
is the method itself -
context
is an object with this content:
{
kind: "method",
name: "someMethod",
isStatic: true,
isPrivate: false,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class has been constructed. This function will receive as this
the
class.
-
undefined
, nothing is replaced -
a new function, it replaces the previous method which was passed as the first parameter
MyClass[Symbol.metadata][key].public.someMethod
class MyClass {
@decorator
#someMethod() {}
}
-
value
is the method itself -
context
is an object with this content:
{
kind: "method",
name: "#someMethod",
access: {
get() { /* ... */ },
},
isStatic: false,
isPrivate: true,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class is instantiated. This function will receive as this
the new
object.
-
undefined
, nothing is replaced -
a new function, it replaces the previous method which was passed as the first parameter
MyClass.prototype[Symbol.metadata][key].private
array.
class MyClass {
@decorator
static #someMethod() {}
}
-
value
is the method itself -
context
is an object with this content:
{
kind: "method",
name: "#someMethod",
access: {
get() { /* ... */ },
},
isStatic: true,
isPrivate: true,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class has been constructed. This function will receive as this
the
class.
-
undefined
, nothing is replaced -
a new function, it replaces the previous method which was passed as the first parameter
MyClass[Symbol.metadata][key].private
array.
class MyClass {
@decorator
get someGetter() {}
}
-
value
is the getter itself -
context
is an object with this content:
{
kind: "getter",
name: "someGetter",
isStatic: false,
isPrivate: false,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class is instantiated. This function will receive as this
the new
object.
-
undefined
, nothing is replaced -
a new function, it replaces the previous getter which was passed as the first parameter
MyClass.prototype[Symbol.metadata][key].public.someGetter
class MyClass {
@decorator
set someSetter(value) {}
}
-
value
is the setter itself -
context
is an object with this content:
{
kind: "setter",
name: "someSetter",
isStatic: false,
isPrivate: false,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class is instantiated. This function will receive as this
the new
object.
-
undefined
, nothing is replaced -
a new function, it replaces the previous setter which was passed as the first parameter
MyClass.prototype[Symbol.metadata][key].public.someSetter
class MyClass {
@decorator
static get someGetter() {}
}
-
value
is the getter itself -
context
is an object with this content:
{
kind: "getter",
name: "someGetter",
isStatic: true,
isPrivate: false,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class has been constructed. This function will receive as this
the
class.
-
undefined
, nothing is replaced -
a new function, it replaces the previous getter which was passed as the first parameter
MyClass[Symbol.metadata][key].public.someGetter
class MyClass {
@decorator
static set someSetter(value) {}
}
-
value
is the setter itself -
context
is an object with this content:
{
kind: "setter",
name: "someSetter",
isStatic: true,
isPrivate: false,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class has been constructed. This function will receive as this
the
class.
-
undefined
, nothing is replaced -
a new function, it replaces the previous setter which was passed as the first parameter
MyClass[Symbol.metadata][key].public.someSetter
class MyClass {
@decorator
get #someGetter() {}
}
-
value
is the getter itself -
context
is an object with this content:
{
kind: "getter",
name: "#someGetter",
access: {
get() { /* ... */ },
},
isStatic: false,
isPrivate: true,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class is instantiated. This function will receive as this
the new
object.
-
undefined
, nothing is replaced -
a new function, it replaces the previous getter which was passed as the first parameter
MyClass.prototype[Symbol.metadata][key].private
array.
class MyClass {
@decorator
set #someSetter(value) {}
}
-
value
is the setter itself -
context
is an object with this content:
{
kind: "setter",
name: "#someSetter",
access: {
set(value) { /* ... */ },
},
isStatic: false,
isPrivate: true,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class is instantiated. This function will receive as this
the new
object.
-
undefined
, nothing is replaced -
a new function, it replaces the previous setter which was passed as the first parameter
MyClass.prototype[Symbol.metadata][key].private
array.
class MyClass {
@decorator
static get #someGetter() {}
}
-
value
is the getter itself -
context
is an object with this content:
{
kind: "getter",
name: "#someGetter",
access: {
get() { /* ... */ },
},
isStatic: true,
isPrivate: true,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class has been constructed. This function will receive as this
the
class.
-
undefined
, nothing is replaced -
a new function, it replaces the previous getter which was passed as the first parameter
MyClass[Symbol.metadata][key].private
array.
class MyClass {
@decorator
static set #someSetter(value) {}
}
-
value
is the setter itself -
context
is an object with this content:
{
kind: "setter",
name: "#someSetter",
access: {
set(value) { /* ... */ },
},
isStatic: true,
isPrivate: true,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class has been constructed. This function will receive as this
the
class.
-
undefined
, nothing is replaced -
a new function, it replaces the previous setter which was passed as the first parameter
MyClass[Symbol.metadata][key].private
array.
class MyClass {
@decorator
someField = 10;
}
-
value
isundefined
-
context
with this object:
{
kind: "field",
name: "someField",
isStatic: false,
isPrivate: false,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class is instantiated. This function will receive as this
the new
object.
-
undefined
, nothing is replaced -
a new function, its return value will be used as the initial value of the field.
MyClass.prototype[Symbol.metadata][key].public.someField
class MyClass {
@decorator
accessor someField = 10;
}
-
value
is the accessor field itself (a getter and setter pair) -
context
is an object with this content:
{
kind: "auto-accesor",
name: "someField",
isStatic: false,
isPrivate: false,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class is instantiated. This function will receive as this
the new
object.
-
undefined
, nothing is replaced -
an object with this structure:
{
get() {}, // replaces previous getter which was passed in the first parameter
set(value) {}, // replaces previous setter which was passed in the first parameter
initialize(initialValue) {}, // initializes accessor initial value
}
MyClass.prototype[Symbol.metadata][key].public.someField
class MyClass {
@decorator
static someField = 1;
}
-
value
isundefined
-
context
is an object with this content:
{
kind: "field",
name: "someField",
isStatic: true,
isPrivate: false,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class has been constructed. This function will receive as this
the
class.
-
undefined
, nothing is replaced -
a new function, its return value will be used as the initial value of the field.
MyClass[Symbol.metadata][key].public.someField
class MyClass {
@decorator
static accessor someField = 10;
}
-
value
is the accessor field itself (a getter and setter pair) -
context
is an object with this content:
{
kind: "auto-accesor",
name: "someField",
isStatic: true,
isPrivate: false,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class has been constructed. This function will receive as this
the
class.
-
undefined
, nothing is replaced -
an object with this structure:
{
get() {}, // replaces previous getter which was passed in the first parameter
set(value) {}, // replaces previous setter which was passed in the first parameter
initialize(initialValue) {}, // initializes accessor initial value
}
MyClass[Symbol.metadata][key].public.someField
class MyClass {
@decorator
#someField = 1;
}
-
value
isundefined
-
context
is an object with this content:
{
kind: "field",
name: "#someField",
isStatic: true,
isPrivate: false,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class is instantiated. This function will receive as this
the new
object.
-
undefined
, nothing is replaced -
a new function, its return value will be used as the initial value of the field.
MyClass.prototype[Symbol.metadata][key].private
array.
class MyClass {
@decorator
accessor #someField = 10;
}
-
value
is the accessor field itself (a getter and setter pair) -
context
is an object with this content:
{
kind: "auto-accesor",
name: "someField",
accessor: {
get() { /* ... */ },
set() { /* ... */ }
},
isStatic: false,
isPrivate: true,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class is instantiated. This function will receive as this
the new
object.
-
undefined
, nothing is replaced -
an object with this structure:
{
get() {}, // replaces previous getter which was passed in the first parameter
set(value) {}, // replaces previous setter which was passed in the first parameter
initialize(initialValue) {}, // initializes accessor initial value
}
MyClass.prototype[Symbol.metadata][key].public.someField
class MyClass {
@decorator
static #someField = 0;
}
-
value
is the field itself -
context
is an object with this content:
{
kind: "setter",
name: "#someField",
access: {
get() { /* ... */ },
set(value) { /* ... */ },
},
isStatic: true,
isPrivate: true,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class has been constructed. This function will receive as this
the
class.
-
undefined
, nothing is replaced -
a new function, its return value will be used as the initial value of the field.
MyClass[Symbol.metadata][key].private
array.
class MyClass {
@decorator
static accessor #someField = 10;
}
-
value
is the accessor field itself (a getter and setter pair) -
context
is an object with this content:
{
kind: "auto-accesor",
name: "someField",
access: {
get() { /* ... */ },
set(v) { /* ... */ }
},
isStatic: true,
isPrivate: true,
getMetadata(key ) { /* ... */ },
setMetadata(key, value) { /* ... */ },
addInitializer(initalizer) { /* ... */ }
}
The context
object includes the addInitializer()
method that receives as a parameter a function
that will be executed when the class has been constructed. This function will receive as this
the
class.
-
undefined
, nothing is replaced -
an object with this structure:
{
get() {}, // replaces previous getter which was passed in the first parameter
set(value) {}, // replaces previous setter which was passed in the first parameter
initialize(initialValue) {}, // initializes accessor initial value
}
MyClass[Symbol.metadata][key].public.someField
- Export
export
orexport default
. - Anonymous class.