Skip to content

Instantly share code, notes, and snippets.

@eduardolundgren
Last active December 16, 2015 07:39
Show Gist options
  • Save eduardolundgren/5399935 to your computer and use it in GitHub Desktop.
Save eduardolundgren/5399935 to your computer and use it in GitHub Desktop.
Y.Base class editable
A.Editable = A.Base.create('editable', Y.Base, [],
{
initializer: function(config) {
var instance = this,
node = instance.get('node'),
eventType = instance.get('eventType');
node.on(eventType, instance._onEdit, instance);
},
_onEdit: function (event) {
var instance = this;
console.log('the user did keypress on node')
}
},
{
ATTRS: {
node: {
setter: A.one
},
eventType: {
value: 'keypress'
}
}
}
);
// Usage:
// var editable = new A.Editable({ node: '#id' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment