Last active
December 16, 2015 07:39
-
-
Save eduardolundgren/5399935 to your computer and use it in GitHub Desktop.
Y.Base class editable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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