-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.json
More file actions
210 lines (210 loc) · 4.26 KB
/
javascript.json
File metadata and controls
210 lines (210 loc) · 4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
{
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"window onload": {
"prefix": "win",
"body": [
"window.onload = function(){",
"\t$1",
"}"
],
"description": "Log output to console"
},
"this state": {
"prefix": "ts",
"body": [
"this.state.$1"
],
"description": "add this.state"
},
"react onload": {
"prefix": "react2",
"body": [
"import React,{Component} from 'react';",
"",
"class $1 extends Component{",
"\trender(){",
"\t\treturn(",
"\t\t\t<div>$1</div> $2",
"\t\t)",
"}",
"}",
"",
"export default $1"
],
"description": "Log output to console"
},
"react2 onload": {
"prefix": "react",
"body": [
"import React from 'react';",
"",
"export default function $1(props){",
"\treturn(",
"\t\t<div>$1 work</div> ",
"\t)",
"}",
""
],
"description": "Log output to console"
},
"import react ang": {
"prefix": "imp",
"body": [
"import {$2} from '$1';",
"$3"
],
"description": "Log output to console"
},
"react3 onload": {
"prefix": "rn",
"body": [
"import React, {useState} from 'react';",
"import { StyleSheet, Text, View, Button } from 'react-native';",
"",
"function $1(props){",
"\treturn(",
"\t\t<View>",
"\t\t\t<Text>$1 work</Text>",
"\t\t</View> ",
"\t)",
"}",
"",
"export default $1"
],
"description": "Log output to console"
},
"storage chrome": {
"prefix": "storage",
"body": [
"chrome.storage.sync",
],
"description": "chrome storage"
},
"arrow function": {
"prefix": "arw",
"body": [
"= () => { \n\t$1\n}",
],
"description": "arrow function"
},
"useState hook": {
"prefix": "sta",
"body": [
"let [$1,set$1] = useState($2)"
],
"description": "create use state fast code"
},
"document query selector": {
"prefix": "dq",
"body": [
"document.querySelector(\"$1\")$2",
],
"description": "arrow function"
},
"render method": {
"prefix": "rend",
"body": [
"render(){",
"\tlet div = document.createElement(\"div\");",
"\tdiv.className = \"$1\";",
"\tdocument.querySelector(this.parent).append(div);",
"\tdiv.innerHTML = `",
"\n\t$2",
"\t`",
"}"
],
"description": "render method from elazar and yosi! "
},
"try catch": {
"prefix": "tr",
"body": [
"try{",
"\t \"$1\" ",
"}",
"catch(err){",
"\t console.log(err);",
"\t alert(\"There problem, come back later\");",
"}",
],
"description": "try catch"
},
"Form events": {
"prefix": "id_form",
"body": [
"let id_form = document.querySelector(\"#id_form\");",
"id_form.addEventListener(\"submit\", (e) => {",
"\te.preventDefault();\n\t$1",
"})"
],
"description": "Form events from Elazar Ben chaim"
},
"try end catch express": {
"prefix": "tryexp",
"body": [
"try{",
"\t$1",
"}",
"catch(err){",
"\tconsole.log(err);",
"\tres.status(502).json({err})",
"}"
],
"description": "try end catch from Elazar Ben chaim"
},
"doApi react function": {
"prefix": "apireact",
"body": [
"const [ar,setAr] = useState([]);\n",
"useEffect(() => {",
"\tdoApi();",
"},[])\n",
"const doApi = async () => {\n",
"let url = '$url';\n",
"try {",
"\tlet resp = await axios(url);",
"\tconsole.log(resp.data);",
"",
"}",
"catch (err) {",
"\tconsole.log(err);",
"\talert('something wrong come back later');",
"\t}",
"}"
],
"description": "json api function by Naor arza"
},
"new console log": {
"prefix": "wcc",
"body": [
"console.log($1);",
],
"description": "new console log"
}
,
"add useEffect": {
"prefix": "wuseef",
"body": [
"useEffect(()=>{",
"\t$1 ",
"},[])"
],
"description": "add use effect"
},
"try catch react": {
"prefix": "tryr",
"body": [
"try{",
"\t$1 ",
"}",
"catch(err){",
"\tconsole.log(err);",
"\talert(\"There problem , come back later\")",
"}"
],
"description": "try catch for js / react"
}
}