DrSensor / DrSensor/nusa

Global value using `static` property

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
data binding enhancement
Dominant language
JavaScript
Stars
4
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```js
/// script.js
export default class Global {
static count = 0
count = 0
increment() {
Global.count++
this.count++
}
}
```
```html





```
```js
import { page } from "test:page.html"

const scope = page.$$('render-scope')
, increment_button1 = scope[0].$("button")
, [ static_input1
, input1 ] = scope[0].$$('input[type="button"]')
, [ static_input2
, input2 ] = scope[1].$$('input[type="button"]')

assert(static_input1.value === "0")
assert(input1.value === "0")

assert(static_input2.value === "0")
assert(input2.value === "0")

increment_button1.click()

assert(static_input1.value === "1")
assert(input1.value === "1")

assert(static_input2.value === "1")
assert(input2.value === "0") // no change
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.