Sublime Text Plugin to generate Get/Set methods
OOJS helps developers to generate Getters and Setters in Object Oriented JavaScript fashion. This plugin is an enhanced version of existing proto snippet.
Install OOJS
with Package Control and restart Sublime.
# example.js
var exampleNode = function(){
this.prop1;
this.prop2;
this.prop3;
};
/*In this case, the generated code will look like the following*/
exampleNode.prototype.getProp1 = function(){
return this.prop1;
};
exampleNode.prototype.setProp1(prop1){
this.prop1 = prop1;
};
ctrl+alt+z will generate the getter and setter for all selected properties.
ctrl+alt+g will generate the getter for all selected properties.
ctrl+alt+s will generate the setter for all selected properties.
Select the required properties and then choose
- Edit -> OOJS -> OOGS (Getter + Setter)
- Edit -> OOJS -> OOG (Getter)
- Edit -> OOJS -> OOS (Setter)
Select the required properties and then right click and choose
- OO Getter Setter
- OO Getter
- OO Setter
Select the required properties and then right click on the filename in the sidebar and choose
- OO Getter Setter
- OO Getter
- OO Setter
MIT License • © Avinash Jayakumar