Refresh pure JS snippets
This commit is contained in:
parent
077ebf6829
commit
eaf9f2b61a
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 289f0557-4e11-47c5-bcbf-1105bbec41ce
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: anonymousFunction
|
||||
# key: anfn
|
||||
# --
|
||||
|
||||
(${1:params}) => {
|
||||
${2}
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: arrow function
|
||||
# key: af
|
||||
# group: es6
|
||||
# --
|
||||
(${1:arg}) => $0
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 6788dcb5-8d8e-4e30-a97b-83029ecaf89b
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: bindThis
|
||||
# key: bnd
|
||||
# --
|
||||
|
||||
this.${1:methodName} = this.${1:methodName}.bind(this)$0
|
||||
|
|
@ -1,8 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Class
|
||||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: class
|
||||
# key: class
|
||||
# --
|
||||
var ${1:name} = new Class({
|
||||
initialize: function($2) {
|
||||
$0
|
||||
}
|
||||
});
|
||||
class ${1:Class}${2: extends ${3:ParentClass}} {
|
||||
${4:constructor(${5:arg}) {
|
||||
${6:super(arg);}
|
||||
$7
|
||||
}}
|
||||
|
||||
$0
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: class-es6
|
||||
# key: class
|
||||
# group: es6
|
||||
# --
|
||||
class ${1:Class}${2: extends ${3:ParentClass}} {
|
||||
${4:constructor(${5:arg}) {
|
||||
${6:super(arg);}
|
||||
$7
|
||||
}}
|
||||
|
||||
$0
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 983d648f-a7de-4e22-bab9-bca5cd6188a6
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: Comment Big Block
|
||||
# key: cmmb
|
||||
# --
|
||||
|
||||
/**
|
||||
|--------------------------------------------------
|
||||
| $1
|
||||
|--------------------------------------------------
|
||||
*/
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b845ab40-1e04-4d11-bb0c-14266e733945
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.assert
|
||||
# key: cas
|
||||
# --
|
||||
|
||||
console.assert(${1:expression}, ${2:object})
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 9619a671-e44a-4b59-b343-b55b3b1dbbcc
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.clear
|
||||
# key: ccl
|
||||
# --
|
||||
|
||||
console.clear()
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: dcbcd0f7-7827-4f81-9777-809540ef5c10
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.count
|
||||
# key: cco
|
||||
# --
|
||||
|
||||
console.count(${1:label})
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: d2272fe8-85d4-44f5-b74c-39a88bb50487
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.dir
|
||||
# key: cdi
|
||||
# --
|
||||
|
||||
console.dir(${1:object})
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 54ad9659-8b18-40a0-9096-48131f9577da
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.error
|
||||
# key: cer
|
||||
# --
|
||||
|
||||
console.error(${1:object})
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b3954656-b9c0-4061-b436-e7412ce008ad
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.groupEnd
|
||||
# key: cge
|
||||
# --
|
||||
|
||||
console.groupEnd()
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: afebe290-f0e6-403a-9c4f-da33451115cb
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.group
|
||||
# key: cgr
|
||||
# --
|
||||
|
||||
console.group("${1:label}")
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 006ec5e1-f229-4989-b8b2-fe1da1aab907
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.info
|
||||
# key: cin
|
||||
# --
|
||||
|
||||
console.info(${1:object})
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 0a1a6d75-a8e0-43fe-b049-1e96c2e04b51
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.log
|
||||
# key: clg
|
||||
# --
|
||||
|
||||
console.log(${1:object})
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 3d2ddcac-d8c0-4b56-81a7-523eb6621442
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.log (formatted)
|
||||
# key: clo
|
||||
# --
|
||||
|
||||
console.log('${1:object}', ${1:object})
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 9dd0d1c8-f4e8-4d16-8ca1-4ce72e7936cb
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.timeEnd
|
||||
# key: cte
|
||||
# --
|
||||
|
||||
console.timeEnd('${1:object}')
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 3d8fde97-df25-4515-a8e9-5096db21cfb7
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.warn
|
||||
# key: cwa
|
||||
# --
|
||||
|
||||
console.warn(${1:object})
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: const declaration
|
||||
# key: const
|
||||
# group: es6
|
||||
# --
|
||||
const ${1:name} = ${2:initial};
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 1867e4d6-1042-422e-b114-174969b9325e
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: destructingArray
|
||||
# key: dar
|
||||
# --
|
||||
|
||||
const [${1:propertyName}] = ${2:arrayToDestruct}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 0a552742-2fa3-4d23-8fe6-fe7f211b642a
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: destructingObject
|
||||
# key: dob
|
||||
# --
|
||||
|
||||
const {${1:propertyName}} = ${2:objectToDestruct}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 45f3a8b4-7ed0-4d80-aa77-1cf79339b6b6
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: exportDefaultFunction
|
||||
# key: edf
|
||||
# --
|
||||
|
||||
export default (${1:params}) => {
|
||||
$0
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 095f24bf-5c76-4d0b-862e-a1f0ab1e1b95
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: exportNamedFunction
|
||||
# key: enf
|
||||
# --
|
||||
|
||||
export const ${1:functionName} = (${2:params}) => {
|
||||
$0
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: addEvent
|
||||
# --
|
||||
addEvent('${1:event}', function($2) {
|
||||
$0
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: fireEvent
|
||||
# --
|
||||
fireEvent('$0')
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 1391f808-8044-4878-b551-9f129330507c
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: exportAs
|
||||
# key: exa
|
||||
# --
|
||||
|
||||
export { ${2:originalName} as ${3:alias} } from '${1:module}'$0
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b9a77d53-af00-4acc-90e5-0259edef0326
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: exportDestructing
|
||||
# key: exd
|
||||
# --
|
||||
|
||||
export { $2 } from '${1:module}'$0
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 19643fe0-3063-41cd-b384-9f0a51b2f809
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: exportDefault
|
||||
# key: exp
|
||||
# --
|
||||
|
||||
export default $1$0
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: export
|
||||
# key: exp
|
||||
# group: es6
|
||||
# --
|
||||
export${1: default} $0;
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 8d343f0b-28ae-4e2c-84a4-2e557603f28b
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: forIn
|
||||
# key: fin
|
||||
# --
|
||||
|
||||
for(let ${1:item} in ${2:object}) {
|
||||
${0}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: eec73b34-fb19-4d4c-b4fd-853b2eca6f19
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: forOf
|
||||
# key: fof
|
||||
# --
|
||||
|
||||
for(let ${1:item} of ${2:object}) {
|
||||
${0}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: a59f3383-a176-4f60-a992-0d2b983eaa5c
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: forEach
|
||||
# key: fre
|
||||
# --
|
||||
|
||||
${1:array}.forEach(${2:currentItem} => {
|
||||
${0}
|
||||
})
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: getter
|
||||
# key: get
|
||||
# group: es6
|
||||
# --
|
||||
get ${1:prop}() {
|
||||
return $0;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 7c3ddd59-68e7-456c-a906-4241cdaeaf9e
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: importAs
|
||||
# key: ima
|
||||
# --
|
||||
|
||||
import { ${2:originalName} as ${3:alias} } from '${1:module}'$0
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 851254b3-d70e-4024-a557-2629d3d73507
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: importDestructing
|
||||
# key: imd
|
||||
# --
|
||||
|
||||
import { $2 } from '${1:module}'$0
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 13efbfa8-12d3-4570-9602-6d64717d75e3
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: importEverything
|
||||
# key: ime
|
||||
# --
|
||||
|
||||
import * as ${2:alias} from '${1:module}'$0
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 39b0065c-1dd5-4214-a612-1fead18dd677
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: importNoModuleName
|
||||
# key: imn
|
||||
# --
|
||||
|
||||
import '${1:module}'$0
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: fb07fe1d-4cf7-47e9-bca8-51a6438c5d6f
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import
|
||||
# key: imp
|
||||
# --
|
||||
|
||||
import ${2:moduleName} from '${1:module}'$0
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: import
|
||||
# key: imp
|
||||
# group: es6
|
||||
# --
|
||||
import ${1:defaultMember}${2:, { ${3:member} }} from '${4:module}';
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: import member
|
||||
# key: imm
|
||||
# group: es6
|
||||
# --
|
||||
import { ${1:member1}, ${2:member2} } from '${3:module}';
|
|
@ -1,7 +1,8 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: Constructor
|
||||
# name: constructor
|
||||
# key: init
|
||||
# --
|
||||
initialize: function($1) {
|
||||
constructor(${1:arg}) {
|
||||
${2:super(${3:arg});}
|
||||
$0
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: init-es6
|
||||
# key: init
|
||||
# group: es6
|
||||
# --
|
||||
constructor(${1:arg}) {
|
||||
${2:super(${3:arg});}
|
||||
$0
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: let declaration
|
||||
# key: let
|
||||
# group: es6
|
||||
# --
|
||||
let ${1:name} = ${2:initial};
|
|
@ -1,4 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: console.log
|
||||
# --
|
||||
console.log($0);
|
|
@ -1,7 +1,6 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: method
|
||||
# key: met
|
||||
# group: es6
|
||||
# --
|
||||
${1:name}(${2:arg}) {
|
||||
$0
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b8f2656b-94d0-40fc-baf2-d335073ecd54
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: bound method
|
||||
# key: metb
|
||||
# --
|
||||
|
||||
${1:methodName} = (${2:params}) => {
|
||||
${0}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 4650c619-bbd9-4496-955a-1d626fdf8bcb
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: namedFunction
|
||||
# key: nfn
|
||||
# --
|
||||
|
||||
const ${1:name} = (${2:params}) => {
|
||||
${3}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 4d26710e-cad0-4584-8099-87403d4c43cb
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propertyGet
|
||||
# key: pge
|
||||
# --
|
||||
|
||||
get ${1:propertyName}() {
|
||||
return this.${0}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 1f2ca8a4-dda2-4b88-9377-23ec10760aec
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: promise
|
||||
# key: prom
|
||||
# --
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
${1}
|
||||
})
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: Promise
|
||||
# key: prom
|
||||
# group: es6
|
||||
# --
|
||||
new Promise((resolve, reject) => {
|
||||
$0
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b33dbf56-f2ad-489e-bc7b-1b4c2d1657ea
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propertyset
|
||||
# key: pse
|
||||
# --
|
||||
|
||||
set ${1:propertyName}(${2:value}) {
|
||||
${0}
|
||||
}
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: html
|
||||
# --
|
||||
new Request.HTML({
|
||||
onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) {
|
||||
$0
|
||||
}
|
||||
}).${1:get}(${2:url});
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: json
|
||||
# --
|
||||
new Request.JSON({
|
||||
onSuccess: function(responseJSON, responseText) {
|
||||
$0
|
||||
}
|
||||
}).${1:send}(${2:url});
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: setter
|
||||
# key: set
|
||||
# group: es6
|
||||
# --
|
||||
set ${1:prop}(${2:value}) {
|
||||
$0
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 596c0e05-ee02-4d02-85e0-64252296629d
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: setInterval
|
||||
# key: sti
|
||||
# --
|
||||
|
||||
setInterval(() => {
|
||||
${2}
|
||||
}, ${0:intervalInms})
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 6ead1d1a-bf84-4a3d-94fb-59ad97d55414
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: setTimeOut
|
||||
# key: sto
|
||||
# --
|
||||
|
||||
setTimeout(() => {
|
||||
${2}
|
||||
}, ${1:delayInms})
|
||||
|
||||
|
Loading…
Reference in New Issue