-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypescript.json
118 lines (118 loc) · 3.2 KB
/
typescript.json
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
{
// Place your snippets for typescript 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:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
/*###########################################
AWS Allgemein
#############################################*/
"Add amplify config": {
"prefix": "amplifyAddConfig",
"body": [
"import { Amplify } from 'aws-amplify';",
"import awsconfig from '../aws-exports';",
"",
"Amplify.configure(awsconfig);"
],
"description": "Add amplify config to app.modules in client"
},
/*###########################################
Angular
#############################################*/
"Add FileReader": {
"prefix": "angularFileReader",
"body": [
"var reader = new FileReader();",
"reader.readAsDataURL(file);",
"reader.onload = (_event) => {",
"fileUrl = reader.result;",
"}"
],
"description": "Add amplify config to app.modules in client"
},
"REST post template": {
"prefix": "angularRestPost",
"body": [
"async postObject(value) {",
"var body = {",
"key: value",
"}",
"var result;",
"this.requestInit.body = body;",
"",
"await API.post(this.AWS_API, '/path', this.requestInit)",
".then(response => {",
"result = response;",
"})",
".catch(error => {",
"result = { err: error };",
"})",
"",
"return result;"
],
"description": "Add angular rest post"
},
"Add Angular Form Builder Group": {
"prefix": "angularFormBuilderGroup",
"body": [
"formGroup: FormGroup;",
"pswRegex = new RegExp('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\\$%\\^&\\*])');",
"//https://ionicthemes.com/tutorials/about/forms-and-validation-in-ionic",
"this.formGroup = this.formBuilder.group({",
"username: ['',",
"Validators.compose([",
"Validators.required,",
"Validators.minLength(5)",
"]),",
"],",
"email: ['',",
"Validators.compose([",
"Validators.required,",
"Validators.email",
"]),",
"],",
"password: ['',",
"Validators.compose([",
"Validators.minLength(5),",
"Validators.required,",
"Validators.pattern(this.pswRegex)",
"])",
"],",
"terms: ['',",
"Validators.pattern('true')",
"]",
"}, {});",
"",
"// convenience getter for easy access to form fields",
"get f() { return this.signUpForm.controls; }"
],
"description": "Add angular formBuilder Group"
},
/*###########################################
Ionic
#############################################*/
"Add ionic modal": {
"prefix": "ionicModal",
"body": [
"const modal = await this.modalCtrl.create({",
"component: $1",
"swipeToClose: true",
"//For iOS only",
"presentingElement: this.routerOutlet.nativeEl",
"});",
"await modal.present()",
" ",
"const {data} = await modal.onDidDismiss();"
],
"description": "Add ionic modal"
},
}