Merge pull request #203 from mwcz/js_property_snippets

add snippets for property descriptors
This commit is contained in:
Honza Pokorny 2013-05-13 09:37:59 -07:00
commit 3b2de64bce

View File

@ -161,3 +161,40 @@ snippet obj
F.prototype = o;
return new F();
}
# Define multiple properties
snippet props
var ${1:my_object} = Object.defineProperties(
${2:new Object()},
{
${3:property} : {
get : function $1_$3_getter() {
// getter code
},
set : function $1_$3_setter(value) {
// setter code
},
value : ${4:value},
writeable : ${5:boolean},
enumerable : ${6:boolean},
configurable : ${7:boolean}
}
}
);
# Define single property
snippet prop
Object.defineProperty(
${1:object},
"${2:property}",
{
get : function $1_$2_getter() {
// getter code
},
set : function $1_$2_setter(value) {
// setter code
},
value : ${3:value},
writeable : ${4:boolean},
enumerable : ${5:boolean},
configurable : ${6:boolean}
}
);