Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Reactive statements and declarations #3

@ByteOfMelon

Description

@ByteOfMelon

Statements (conditionals)

// What the user types
$: if (test > 10 && color.get() !== color.get_last()) {
    color.set('color: green');
}

// What the compiler outputs to JS
test.subscribe((new_val, old_val) => {
    if (new_val > 10 && color.get() !== color.get_last()) {
        color.set('color: green');
    }
})

Declarations

// What the user types
$: is_greater_than = test > 30;

// What the compiler outputs to JS
let is_greater_than = variable(test > 30);
test.subscribe((new_val, old_val) => {
    is_greater_than.set(test > 30);
})

Metadata

Metadata

Assignees

Labels

compilerThings related to the compiler.enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions