Vmeda.Online/.vscode/moodle.code-snippets

79 lines
2.2 KiB
Plaintext

{
"[Moodle] Component class": {
"scope": "typescript",
"prefix": "macomponent",
"body": [
"import { Component } from '@angular/core';",
"",
"@Component({",
" selector: '$2${TM_FILENAME_BASE}',",
" templateUrl: '${TM_FILENAME_BASE}.html',",
"})",
"export class ${1:${TM_FILENAME_BASE}}Component {",
"",
" $0",
"",
"}",
""
],
"description": "[Moodle] Create a Component class"
},
"[Moodle] Page class": {
"scope": "typescript",
"prefix": "mapage",
"body": [
"import { Component } from '@angular/core';",
"",
"@Component({",
" selector: 'page-$2${TM_FILENAME_BASE}',",
" templateUrl: '${TM_FILENAME_BASE}.html',",
"})",
"export class ${1:${TM_FILENAME_BASE}}Page {",
"",
" $0",
"",
"}",
""
],
"description": "[Moodle] Create a Page class"
},
"[Moodle] Service Singleton": {
"scope": "typescript",
"prefix": "massingleton",
"body": [
"import { Injectable } from '@angular/core';",
"import { makeSingleton } from '@singletons';",
"",
"/**",
" * $2.",
" */",
"@Injectable({ providedIn: 'root' })",
"export class ${1:${TM_FILENAME_BASE}}Service {",
"",
" $0",
"",
"}",
"",
"export class ${1:${TM_FILENAME_BASE}} extends makeSingleton(${1:${TM_FILENAME_BASE}}Service) {}",
""
],
"description": "[Moodle] Create a Service Singleton"
},
"[Moodle] Singleton": {
"scope": "typescript",
"prefix": "masingleton",
"body": [
"/**",
" * Singleton$2.",
" */",
"export class ${1:${TM_FILENAME_BASE}} {",
"",
" $0",
"",
"}",
""
],
"description": "[Moodle] Create a Pure Singleton"
}
}