Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.41 KB | None | 0 0
  1. {
  2. "Constructor": {
  3. "prefix": "ctor",
  4. "body": [
  5. "/**",
  6. " *",
  7. " */",
  8. "constructor() {",
  9. "\tsuper();",
  10. "\t$0",
  11. "}"
  12. ],
  13. "description": "Constructor"
  14. },
  15. "Class Definition": {
  16. "prefix": "class",
  17. "body": [
  18. "class ${1:name} {",
  19. "\tconstructor(${2:parameters}) {",
  20. "\t\t$0",
  21. "\t}",
  22. "}"
  23. ],
  24. "description": "Class Definition"
  25. },
  26. "Public Method Definition": {
  27. "prefix": "public method",
  28. "body": [
  29. "/**",
  30. " * ${1:name}",
  31. " */",
  32. "public ${1:name}() {",
  33. "\t$0",
  34. "}"
  35. ],
  36. "description": "Public Method Definition"
  37. },
  38. "Private Method Definition": {
  39. "prefix": "private method",
  40. "body": [
  41. "private ${1:name}() {",
  42. "\t$0",
  43. "}"
  44. ],
  45. "description": "Private Method Definition"
  46. },
  47. "Import external module.": {
  48. "prefix": "import statement",
  49. "body": [
  50. "import { $0 } from \\'${1:module}\\';"
  51. ],
  52. "description": "Import external module."
  53. },
  54. "Property getter": {
  55. "prefix": "get",
  56. "body": [
  57. "",
  58. "public get ${1:value}() : ${2:string} {",
  59. "\t${3:return $0}",
  60. "}",
  61. ""
  62. ],
  63. "description": "Property getter"
  64. },
  65. "Log to the console": {
  66. "prefix": "log",
  67. "body": [
  68. "console.log($1);",
  69. "$0"
  70. ],
  71. "description": "Log to the console"
  72. },
  73. "Log warning to console": {
  74. "prefix": "warn",
  75. "body": [
  76. "console.warn($1);",
  77. "$0"
  78. ],
  79. "description": "Log warning to the console"
  80. },
  81. "Log error to console": {
  82. "prefix": "error",
  83. "body": [
  84. "console.error($1);",
  85. "$0"
  86. ],
  87. "description": "Log error to the console"
  88. },
  89. "Define a full property": {
  90. "prefix": "prop",
  91. "body": [
  92. "",
  93. "private _${1:value} : ${2:string};",
  94. "public get ${1:value}() : ${2:string} {",
  95. "\treturn this._${1:value};",
  96. "}",
  97. "public set ${1:value}(v : ${2:string}) {",
  98. "\tthis._${1:value} = v;",
  99. "}",
  100. ""
  101. ],
  102. "description": "Define a full property"
  103. },
  104. "Triple-slash reference": {
  105. "prefix": "ref",
  106. "body": [
  107. "/// <reference path=\"$1\" />",
  108. "$0"
  109. ],
  110. "description": "Triple-slash reference"
  111. },
  112. "Property setter": {
  113. "prefix": "set",
  114. "body": [
  115. "",
  116. "public set ${1:value}(v : ${2:string}) {",
  117. "\tthis.$3 = v;",
  118. "}",
  119. ""
  120. ],
  121. "description": "Property setter"
  122. },
  123. "Throw Exception": {
  124. "prefix": "throw",
  125. "body": [
  126. "throw \"$1\";",
  127. "$0"
  128. ],
  129. "description": "Throw Exception"
  130. },
  131. "For Loop": {
  132. "prefix": "for",
  133. "body": [
  134. "for (let ${1:index} = 0; ${1:index} < ${2:array}.length; ${1:index}++) {",
  135. "\tconst ${3:element} = ${2:array}[${1:index}];",
  136. "\t$0",
  137. "}"
  138. ],
  139. "description": "For Loop"
  140. },
  141. "For-Each Loop using =>": {
  142. "prefix": "foreach =>",
  143. "body": [
  144. "${1:array}.forEach(${2:element} => {",
  145. "\t$0",
  146. "});"
  147. ],
  148. "description": "For-Each Loop using =>"
  149. },
  150. "For-In Loop": {
  151. "prefix": "forin",
  152. "body": [
  153. "for (const ${1:key} in ${2:object}) {",
  154. "\tif (${2:object}.hasOwnProperty(${1:key})) {",
  155. "\t\tconst ${3:element} = ${2:object}[${1:key}];",
  156. "\t\t$0",
  157. "\t}",
  158. "}"
  159. ],
  160. "description": "For-In Loop"
  161. },
  162. "For-Of Loop": {
  163. "prefix": "forof",
  164. "body": [
  165. "for (const ${1:iterator} of ${2:object}) {",
  166. "\t$0",
  167. "}"
  168. ],
  169. "description": "For-Of Loop"
  170. },
  171. "Function Statement": {
  172. "prefix": "function",
  173. "body": [
  174. "function ${1:name}(${2:params}:${3:type}) {",
  175. "\t$0",
  176. "}"
  177. ],
  178. "description": "Function Statement"
  179. },
  180. "If Statement": {
  181. "prefix": "if",
  182. "body": [
  183. "if (${1:condition}) {",
  184. "\t$0",
  185. "}"
  186. ],
  187. "description": "If Statement"
  188. },
  189. "If-Else Statement": {
  190. "prefix": "ifelse",
  191. "body": [
  192. "if (${1:condition}) {",
  193. "\t$0",
  194. "} else {",
  195. "\t",
  196. "}"
  197. ],
  198. "description": "If-Else Statement"
  199. },
  200. "New Statement": {
  201. "prefix": "new",
  202. "body": [
  203. "const ${1:name} = new ${2:type}(${3:arguments});$0"
  204. ],
  205. "description": "New Statement"
  206. },
  207. "Switch Statement": {
  208. "prefix": "switch",
  209. "body": [
  210. "switch (${1:key}) {",
  211. "\tcase ${2:value}:",
  212. "\t\t$0",
  213. "\t\tbreak;",
  214. "",
  215. "\tdefault:",
  216. "\t\tbreak;",
  217. "}"
  218. ],
  219. "description": "Switch Statement"
  220. },
  221. "While Statement": {
  222. "prefix": "while",
  223. "body": [
  224. "while (${1:condition}) {",
  225. "\t$0",
  226. "}"
  227. ],
  228. "description": "While Statement"
  229. },
  230. "Do-While Statement": {
  231. "prefix": "dowhile",
  232. "body": [
  233. "do {",
  234. "\t$0",
  235. "} while (${1:condition});"
  236. ],
  237. "description": "Do-While Statement"
  238. },
  239. "Try-Catch Statement": {
  240. "prefix": "trycatch",
  241. "body": [
  242. "try {",
  243. "\t$0",
  244. "} catch (${1:error}) {",
  245. "\t",
  246. "}"
  247. ],
  248. "description": "Try-Catch Statement"
  249. },
  250. "Set Timeout Function": {
  251. "prefix": "settimeout",
  252. "body": [
  253. "setTimeout(() => {",
  254. "\t$0",
  255. "}, ${1:timeout});"
  256. ],
  257. "description": "Set Timeout Function"
  258. },
  259. "Region Start": {
  260. "prefix": "#region",
  261. "body": [
  262. "//#region $0"
  263. ],
  264. "description": "Folding Region Start"
  265. },
  266. "Region End": {
  267. "prefix": "#endregion",
  268. "body": [
  269. "//#endregion"
  270. ],
  271. "description": "Folding Region End"
  272. }
  273. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement