oktatas:telefon:nativescript:template-hello-world-ts
Különbségek
A kiválasztott változat és az aktuális verzió közötti különbségek a következők.
Előző változat mindkét oldalonElőző változatKövetkező változat | Előző változat | ||
oktatas:telefon:nativescript:template-hello-world-ts [2023/03/24 20:27] – [A főlap] admin | oktatas:telefon:nativescript:template-hello-world-ts [2023/03/24 20:28] (aktuális) – [NativeScript - template-hello-world-ts] admin | ||
---|---|---|---|
Sor 4: | Sor 4: | ||
* **Szerző: | * **Szerző: | ||
- | * Copyright (c) Sallai András, | + | * Copyright (c) Sallai András, |
* Licenc: [[https:// | * Licenc: [[https:// | ||
* Web: https:// | * Web: https:// | ||
Sor 63: | Sor 63: | ||
} | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | <code javascript app/ | ||
+ | import { Observable } from ' | ||
+ | |||
+ | export class HelloWorldModel extends Observable { | ||
+ | private _counter: number | ||
+ | private _message: string | ||
+ | |||
+ | constructor() { | ||
+ | super() | ||
+ | |||
+ | // Initialize default values. | ||
+ | this._counter = 42 | ||
+ | this.updateMessage() | ||
+ | } | ||
+ | |||
+ | get message(): string { | ||
+ | return this._message | ||
+ | } | ||
+ | |||
+ | set message(value: | ||
+ | if (this._message !== value) { | ||
+ | this._message = value | ||
+ | this.notifyPropertyChange(' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | onTap() { | ||
+ | this._counter-- | ||
+ | this.updateMessage() | ||
+ | } | ||
+ | |||
+ | private updateMessage() { | ||
+ | if (this._counter <= 0) { | ||
+ | this.message = ' | ||
+ | } else { | ||
+ | this.message = `${this._counter} taps left` | ||
+ | } | ||
+ | } | ||
+ | } | ||
</ | </ | ||
oktatas/telefon/nativescript/template-hello-world-ts.1679686025.txt.gz · Utolsó módosítás: 2023/03/24 20:27 szerkesztette: admin