Felhasználói eszközök

Eszközök a webhelyen


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.

Összehasonlító nézet linkje

Előző változat mindkét oldalonElőző változat
Következő változat
Előző változat
oktatas:telefon:nativescript:template-hello-world-ts [2023/03/24 20:27] – [A főlap] adminoktatas:telefon:nativescript:template-hello-world-ts [2023/03/24 20:28] (aktuális) – [NativeScript - template-hello-world-ts] admin
Sor 4: Sor 4:
  
   * **Szerző:** Sallai András   * **Szerző:** Sallai András
-  * Copyright (c) Sallai András, 2021+  * Copyright (c) Sallai András, 2023
   * Licenc: [[https://creativecommons.org/licenses/by-sa/4.0/|CC Attribution-Share Alike 4.0 International]]   * Licenc: [[https://creativecommons.org/licenses/by-sa/4.0/|CC Attribution-Share Alike 4.0 International]]
   * Web: https://szit.hu   * Web: https://szit.hu
Sor 63: Sor 63:
 } }
  
 +</code>
 +
 +
 +<code javascript app/main-view-model.ts>
 +import { Observable } from '@nativescript/core'
 +
 +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: string) {
 +    if (this._message !== value) {
 +      this._message = value
 +      this.notifyPropertyChange('message', value)
 +    }
 +  }
 +
 +  onTap() {
 +    this._counter--
 +    this.updateMessage()
 +  }
 +
 +  private updateMessage() {
 +    if (this._counter <= 0) {
 +      this.message = 'Hoorraaay! You unlocked the NativeScript clicker achievement!'
 +    } else {
 +      this.message = `${this._counter} taps left`
 +    }
 +  }
 +}
 </code> </code>
  
oktatas/telefon/nativescript/template-hello-world-ts.1679686025.txt.gz · Utolsó módosítás: 2023/03/24 20:27 szerkesztette: admin