Last active
February 23, 2017 18:13
-
-
Save leetheguy/4e3a9fdafdc1ca34c27035a59e3dacd4 to your computer and use it in GitHub Desktop.
illustrating getters and setters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@angular/core'; | |
| import { Http } from '@angular/http'; | |
| import 'rxjs/add/operator/map'; | |
| @Injectable() | |
| export class SettingsService { | |
| _pomLength: number; | |
| _shortBreakLength: number; | |
| _longBreakLength: number; | |
| constructor(public http: Http) { | |
| _pomLength = 1500; | |
| _shortBreakLength = 300; | |
| _longBreakLength = 1800; | |
| } | |
| get pomLength(): number { | |
| return this._pomLength; | |
| } | |
| set pomLength(value: number) { | |
| this._pomLength = value; | |
| } | |
| get shortBreakLength(): number { | |
| return this._shortBreakLength; | |
| } | |
| set shortBreakLength(value: number) { | |
| this._shortBreakLength = value; | |
| } | |
| get longBreakLength(): number { | |
| return this._longBreakLength; | |
| } | |
| set longBreakLength(value: number) { | |
| this._longBreakLength = value; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment