4 "body": ["/**", " *", " */", "constructor() {", "\tsuper();", "\t$0", "}"],
5 "description": "Constructor"
11 "\tconstructor(${2:parameters}) {",
16 "description": "Class Definition"
18 "Public Method Definition": {
19 "prefix": "public method",
20 "body": ["/**", " * ${1:name}", " */", "public ${1:name}() {", "\t$0", "}"],
21 "description": "Public Method Definition"
23 "Private Method Definition": {
24 "prefix": "private method",
25 "body": ["private ${1:name}() {", "\t$0", "}"],
26 "description": "Private Method Definition"
28 "Import external module.": {
29 "prefix": "import statement",
30 "body": ["import { $0 } from \"${1:module}\";"],
31 "description": "Import external module."
37 "public get ${1:value}() : ${2:string} {",
42 "description": "Property getter"
44 "Log to the console": {
46 "body": ["console.log($1);", "$0"],
47 "description": "Log to the console"
49 "Log warning to console": {
51 "body": ["console.warn($1);", "$0"],
52 "description": "Log warning to the console"
54 "Log error to console": {
56 "body": ["console.error($1);", "$0"],
57 "description": "Log error to the console"
59 "Define a full property": {
63 "private _${1:value} : ${2:string};",
64 "public get ${1:value}() : ${2:string} {",
65 "\treturn this._${1:value};",
67 "public set ${1:value}(v : ${2:string}) {",
68 "\tthis._${1:value} = v;",
72 "description": "Define a full property"
74 "Triple-slash reference": {
76 "body": ["/// <reference path=\"$1\" />", "$0"],
77 "description": "Triple-slash reference"
83 "public set ${1:value}(v : ${2:string}) {",
88 "description": "Property setter"
92 "body": ["throw new Error(\"$1\");", "$0"],
93 "description": "Throw Exception"
98 "for (let ${1:index} = 0; ${1:index} < ${2:array}.length; ${1:index}++) {",
99 "\tconst ${3:element} = ${2:array}[${1:index}];",
103 "description": "For Loop"
105 "For-Each Loop using =>": {
106 "prefix": "foreach =>",
107 "body": ["${1:array}.forEach(${2:element} => {", "\t$0", "});"],
108 "description": "For-Each Loop using =>"
113 "for (const ${1:key} in ${2:object}) {",
114 "\tif (Object.prototype.hasOwnProperty.call(${2:object}, ${1:key})) {",
115 "\t\tconst ${3:element} = ${2:object}[${1:key}];",
120 "description": "For-In Loop"
124 "body": ["for (const ${1:iterator} of ${2:object}) {", "\t$0", "}"],
125 "description": "For-Of Loop"
127 "For-Await-Of Loop": {
128 "prefix": "forawaitof",
129 "body": ["for await (const ${1:iterator} of ${2:object}) {", "\t$0", "}"],
130 "description": "For-Await-Of Loop"
132 "Function Statement": {
133 "prefix": "function",
134 "body": ["function ${1:name}(${2:params}:${3:type}) {", "\t$0", "}"],
135 "description": "Function Statement"
139 "body": ["if (${1:condition}) {", "\t$0", "}"],
140 "description": "If Statement"
142 "If-Else Statement": {
144 "body": ["if (${1:condition}) {", "\t$0", "} else {", "\t", "}"],
145 "description": "If-Else Statement"
149 "body": ["const ${1:name} = new ${2:type}(${3:arguments});$0"],
150 "description": "New Statement"
152 "Switch Statement": {
155 "switch (${1:key}) {",
156 "\tcase ${2:value}:",
164 "description": "Switch Statement"
168 "body": ["while (${1:condition}) {", "\t$0", "}"],
169 "description": "While Statement"
171 "Do-While Statement": {
173 "body": ["do {", "\t$0", "} while (${1:condition});"],
174 "description": "Do-While Statement"
176 "Try-Catch Statement": {
177 "prefix": "trycatch",
178 "body": ["try {", "\t$0", "} catch (${1:error}) {", "\t", "}"],
179 "description": "Try-Catch Statement"
181 "Set Timeout Function": {
182 "prefix": "settimeout",
183 "body": ["setTimeout(() => {", "\t$0", "}, ${1:timeout});"],
184 "description": "Set Timeout Function"
188 "body": ["//#region $0"],
189 "description": "Folding Region Start"
192 "prefix": "#endregion",
193 "body": ["//#endregion"],
194 "description": "Folding Region End"
197 "prefix": "newpromise",
198 "body": ["new Promise<${1:type}>((resolve, reject) => {", "\t$2", "})"],
199 "description": "Create a new Promise"
201 "Async Function Statement": {
202 "prefix": "async function",
203 "body": ["async function ${1:name}(${2:params}:${3:type}) {", "\t$0", "}"],
204 "description": "Async Function Statement"
206 "Async Function Expression": {
207 "prefix": "async arrow function",
208 "body": ["async (${1:params}:${2:type}) => {", "\t$0", "}"],
209 "description": "Async Function Expression"