Fusion Syntax
Literals
bookTitle = 'The Guide'
chapterTitle = "Universe"
answer = 42
isAwesome = true
Comments
// Line comment
# Another line comment
/*
* Multiline comment
*/
Expressions
caluclated = ${'USD ' + 1337}
rounded = ${Math.floor(3.14)}
If you want to know more about what is possible inside the expressions, read the section about eel expressions and eel helpers.
Objects
Property Definition
obj = {
someProperty = 'value'
}
// is the same as
obj.someProperty = 'value'
Clear property
obj {
myProp >
}
// is the same as
obj.myProp >
Prototypes
Definition
prototype(MyCustomComponent) {
myProp = 'Some value'
}
Extension
prototype(MyCustomComponent) < prototype(Component) {
…
}
Hierarchical override
prototype(Book) < prototype(Component) {
prototype(Input).attributes.type = 'email'
}
Override type attribute of all Input
Prototypes inside Book
to "email"
Decorators / meta properties
For every property you can define decorators. For instance you can hide a property by defining a @if
decorator and setting it to false:
Example
prototype(MyComponent) < prototype(Fusion:Component) {
myProp = 'value'
myProp.@if.someKeyToIdentifyThisDecorator = false
renderer = ${'String: ' + props.myProp}
}
Preview
String: