mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
141
extensions/javascript/snippets/javascriptreact.json
Normal file
141
extensions/javascript/snippets/javascriptreact.json
Normal file
@@ -0,0 +1,141 @@
|
||||
{
|
||||
"define module": {
|
||||
"prefix": "define",
|
||||
"body": [
|
||||
"define([",
|
||||
"\t'require',",
|
||||
"\t'${dependency}'",
|
||||
"], function(require, ${factory}) {",
|
||||
"\t'use strict';",
|
||||
"\t$0",
|
||||
"});"
|
||||
],
|
||||
"description": "define module"
|
||||
},
|
||||
"For Loop": {
|
||||
"prefix": "for",
|
||||
"body": [
|
||||
"for (var ${index} = 0; ${index} < ${array}.length; ${index}++) {",
|
||||
"\tvar ${element} = ${array}[${index}];",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "For Loop"
|
||||
},
|
||||
"For-Each Loop": {
|
||||
"prefix": "foreach",
|
||||
"body": [
|
||||
"${array}.forEach(function(${element}) {",
|
||||
"\t$0",
|
||||
"}, this);"
|
||||
],
|
||||
"description": "For-Each Loop"
|
||||
},
|
||||
"For-In Loop": {
|
||||
"prefix": "forin",
|
||||
"body": [
|
||||
"for (var ${key} in ${object}) {",
|
||||
"\tif (${object}.hasOwnProperty(${key})) {",
|
||||
"\t\tvar ${element} = ${object}[${key}];",
|
||||
"\t\t$0",
|
||||
"\t}",
|
||||
"}"
|
||||
],
|
||||
"description": "For-In Loop"
|
||||
},
|
||||
"Function Statement": {
|
||||
"prefix": "function",
|
||||
"body": [
|
||||
"function ${name}(${params}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "Function Statement"
|
||||
},
|
||||
"If Statement": {
|
||||
"prefix": "if",
|
||||
"body": [
|
||||
"if (${condition}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "If Statement"
|
||||
},
|
||||
"If-Else Statement": {
|
||||
"prefix": "ifelse",
|
||||
"body": [
|
||||
"if (${condition}) {",
|
||||
"\t$0",
|
||||
"} else {",
|
||||
"\t",
|
||||
"}"
|
||||
],
|
||||
"description": "If-Else Statement"
|
||||
},
|
||||
"New Statement": {
|
||||
"prefix": "new",
|
||||
"body": [
|
||||
"var ${name} = new ${type}(${arguments});$0"
|
||||
],
|
||||
"description": "New Statement"
|
||||
},
|
||||
"Switch Statement": {
|
||||
"prefix": "switch",
|
||||
"body": [
|
||||
"switch (${key}) {",
|
||||
"\tcase ${value}:",
|
||||
"\t\t$0",
|
||||
"\t\tbreak;",
|
||||
"",
|
||||
"\tdefault:",
|
||||
"\t\tbreak;",
|
||||
"}"
|
||||
],
|
||||
"description": "Switch Statement"
|
||||
},
|
||||
"While Statement": {
|
||||
"prefix": "while",
|
||||
"body": [
|
||||
"while (${condition}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "While Statement"
|
||||
},
|
||||
"Do-While Statement": {
|
||||
"prefix": "dowhile",
|
||||
"body": [
|
||||
"do {",
|
||||
"\t$0",
|
||||
"} while (${condition});"
|
||||
],
|
||||
"description": "Do-While Statement"
|
||||
},
|
||||
"Try-Catch Statement":{
|
||||
"prefix": "trycatch",
|
||||
"body": [
|
||||
"try {",
|
||||
"\t$0",
|
||||
"} catch (${error}) {",
|
||||
"\t",
|
||||
"}"
|
||||
],
|
||||
"description": "Try-Catch Statement"
|
||||
},
|
||||
"Set Timeout Function": {
|
||||
"prefix": "settimeout",
|
||||
"body": [
|
||||
"setTimeout(function() {",
|
||||
"\t$0",
|
||||
"}, ${timeout});"
|
||||
],
|
||||
"description": "Set Timeout Function"
|
||||
},
|
||||
"Relative Reference to another File": {
|
||||
"prefix": "reference",
|
||||
"body": [
|
||||
"/// <reference path=\"$1\" />$0"
|
||||
],
|
||||
"description": "Relative Reference to another File"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user