UNPKG

2.23 kBPlain TextView Raw
1import { ElementRef } from '@angular/core';
2
3import { Direction } from '../miscellaneous/miscellaneous';
4
5export class Tada {}
6
7/**
8 * The todo class
9 * See {@link TodoStore} for service using it
10 */
11export class Todo extends Tada {
12 /**
13 * Completed status
14 */
15 completed: boolean;
16 /**
17 * Editing status
18 */
19 editing: boolean;
20
21 pos?: PopupPosition;
22
23 /**
24 * Another private property
25 */
26 #newprivateproperty: boolean = false;
27
28 private optionalProperty?: boolean;
29
30 [index: number]: string;
31
32 testCommentFunction(dig: number, str: string, bool: boolean): object {
33 return {};
34 }
35
36 dir: Direction = Direction.Left;
37
38 /**
39 * Title
40 */
41 private _title: string;
42 /**
43 * @return {string} _title value
44 */
45 get title() {
46 return this._title;
47 }
48 /**
49 * Setter of _title
50 * @param {string} value The new title
51 */
52 set title(value: string) {
53 this._title = value.trim();
54 }
55
56 static classMethod() {
57 return 'hello';
58 }
59
60 /**
61 * Returns the runtime path
62 * @returns {string}
63 */
64 get runtimePath() {
65 return this._options.runtimePath;
66 }
67
68 /**
69 * The todo constructor
70 * Watch {@link TodoStore} for service using it
71 */
72 constructor(title: string) {
73 this.completed = false;
74 this.editing = false;
75 this.title = title.trim();
76 }
77
78 /**
79 * fakeMethod !!
80 * @example <caption>Usage of fakeMethod</caption>
81 * returns true;
82 * fakeMethod()
83 */
84 fakeMethod(): boolean {
85 return true;
86 }
87
88 azert() {
89 return 5;
90 }
91
92 abstract abstractMethod(input: string): string;
93
94 async asyncMethod() {}
95
96 url2state = async <T>(defaults: Partial<T>) =>
97 await this.route.queryParamMap
98 .pipe(
99 /** use first to make sure this only runs at component init time */
100 first(),
101 map(r => {}),
102 catchError(e => {})
103 )
104 /** cast observable to promise */
105 .toPromise();
106
107 #clicked() {
108 this.editing = true;
109 }
110}
111
112export type PopupPosition = ElementRef | HTMLElement;