Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

chore(): more snippets + remove pwa prefix #75

Merged
merged 2 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions snippets/pwa-windows.js.code-snippets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ // Badges
"Badge Display": {
"scope": "javascript,typescript",
"prefix": "pwa-badge-display",
"prefix": "badge-display",
"body": [
"navigator.setAppBadge($1).then(() => {",
"\t${2:console.log(\"The badge was added\")};",
Expand All @@ -13,7 +13,7 @@
},
"Badge Clear": {
"scope": "javascript,typescript",
"prefix": "pwa-badge-clear",
"prefix": "badge-clear",
"body": [
"navigator.clearAppBadge($1).then(() => {",
"\t${2:console.log(\"The badge was cleared\")};",
Expand All @@ -26,7 +26,7 @@
// Notifications
"Notification Request Permission": {
"scope": "javascript,typescript",
"prefix": "pwa-notification-request-permission",
"prefix": "notification-request-permission",
"body": [
"// Requesting permission should only be done in response to a user action. This is a best practice, to avoid interrupting the user with permission prompts when the user hasn't yet interacted with a feature that uses notifications.",
"${1:button}.addEventListener(\"${2:click}\", () => {",
Expand All @@ -41,7 +41,7 @@
},
"Notification Display": {
"scope": "javascript,typescript",
"prefix": "pwa-notification-display",
"prefix": "notification-display",
"body": [
"const notification = new Notification(\"${1:Hello World!}\", {",
"\tbody: \"${2:Body of my notification message}\",",
Expand All @@ -51,7 +51,7 @@
},
"Notification Display from Service Worker": {
"scope": "javascript,typescript",
"prefix": "pwa-notification-display-sw",
"prefix": "notification-display-sw",
"body": [
"// You can display notifications from your app's service worker. This is useful because the service worker may be doing work while your app isn't running.",
"self.registration.showNotification(\"${1:Your content is ready}\", {",
Expand All @@ -67,7 +67,7 @@
},
"Notification Click from Service Worker": {
"scope": "javascript,typescript",
"prefix": "pwa-notification-click-sw",
"prefix": "notification-click-sw",
"body": [
"// When the user clicks one of the action buttons, your PWA can handle the click by listening for the notificationclick event.",
"self.addEventListener(\"notificationclick\", event => {",
Expand All @@ -85,7 +85,7 @@
// Handle files
"File handle on launch": {
"scope": "javascript,typescript",
"prefix": "pwa-file-launch",
"prefix": "file-launch",
"body": [
"// When your app is launched by the OS after a file was opened, you can use the launchQueue object to access the file content.",
"if ('launchQueue' in window) {",
Expand Down
35 changes: 32 additions & 3 deletions snippets/pwa-windows.json.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Icons
"Icons": {
"scope": "json",
"prefix": "pwa-icons",
"prefix": "icons",
"body": [
"\"icons\": [",
"\t{",
Expand Down Expand Up @@ -33,7 +33,7 @@
// Theme color
"Theme Color": {
"scope": "json",
"prefix": "pwa-theme-color",
"prefix": "theme-color",
"body": [
"\"theme_color\": \"${0:#0d4c73}\""
],
Expand All @@ -43,7 +43,7 @@
// Handle files
"File Handlers": {
"scope": "json",
"prefix": "pwa-file-handlers",
"prefix": "file-handlers",
"body": [
"\"file_handlers\": [",
"\t{",
Expand All @@ -56,5 +56,34 @@
"\t}",
"]"
],
},

"Shortcuts" : {
"scope": "json",
"prefix": "shortcuts",
"body": [
"\"shortcuts\": [",
"\t{",
"\t\t\"name\":\"${15:The name you would like to be displayed for your shortcut}\",",
"\t\t\"url\":\"${16:The url you would like to open when the user chooses this shortcut. This must be a URL local to your PWA. For example: If my start_url is /, this URL must be something like /shortcut}\",",
"\t\t\"description\":\"${17:A description of the functionality of this shortcut}\"",
"\t}",
"]",
]
},

"Screenshots" : {
"scope": "json",
"prefix": "screenshots",
"body": [
"\"screenshots\": [",
"\t{",
"\t\t\"src\":\"${15:The src to your screenshot}\",",
"\t\t\"sizes\":\"${16:The size of your screenshot, such as 2880x1800}\",",
"\t\t\"type\":\"${17:The type of your image, such as image/png}\"",
"\t\t\"description\":\"${17:A description of the screenshot}\"",
"\t}",
"]",
]
}
}