Skip to content

Instantly share code, notes, and snippets.

@jswebschmiede
Last active November 19, 2022 12:58
Show Gist options
  • Save jswebschmiede/f2ccd2d5c12daafbe5aa804d44297ed2 to your computer and use it in GitHub Desktop.
Save jswebschmiede/f2ccd2d5c12daafbe5aa804d44297ed2 to your computer and use it in GitHub Desktop.

Revisions

  1. Joerg Schoeneburg revised this gist Nov 19, 2022. 1 changed file with 1 addition and 15 deletions.
    16 changes: 1 addition & 15 deletions javascript.json
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,4 @@
    {
    // 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:
    // "Print to console": {
    // "prefix": "log",
    // "body": [
    // "console.log('$1');",
    // "$2"
    // ],
    // "description": "Log output to console"
    // }

    "Arrow Function": {
    "prefix": "arrow",
    "body": ["const $1 = () => {", "$0", "}"],
    @@ -41,4 +27,4 @@
    "body": ["$1.addEventListener('$2', (e) => {", " $0", "});"],
    "description": "Add Event Listener"
    }
    }
    }
  2. Joerg Schoeneburg created this gist Nov 19, 2022.
    44 changes: 44 additions & 0 deletions javascript.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    {
    // 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:
    // "Print to console": {
    // "prefix": "log",
    // "body": [
    // "console.log('$1');",
    // "$2"
    // ],
    // "description": "Log output to console"
    // }

    "Arrow Function": {
    "prefix": "arrow",
    "body": ["const $1 = () => {", "$0", "}"],
    "description": "Arrow Function"
    },
    "Fetch": {
    "prefix": "fetch",
    "body": [
    "try {",
    " const res = await fetch('$1');",
    " const data = await res.json();",
    "",
    "} catch (err) {",
    " console.error(err);",
    "}"
    ],
    "description": "Fetch"
    },
    "Get Element by Id": {
    "prefix": "getid",
    "body": ["const $el = document.getElementById('$el');"],
    "description": "Get Element by Id"
    },
    "Add Event Listener": {
    "prefix": "addevent",
    "body": ["$1.addEventListener('$2', (e) => {", " $0", "});"],
    "description": "Add Event Listener"
    }
    }