JSFiddle - React, Tailwind, and code Playground
HTML
<button id="myButton">Click Me (using object scope)</button><br />
<button id="myButton2">Click Me (using global/window scope)</button>
JavaScript
var myObject = {
say: function(message){
alert(message);
}
};
Ext.fly("myButton").on("click", function(event, element, options){
this.say(options.message);
}, myObject, {
message: "Hello World"
});
// Note: the default global scope in JavaScript is `window`. `alert()` is actually
// a shortcut for `window.alert()`, so the following code will work.
Ext.fly("myButton2").on("click", function(event, element, options){
this.alert(options.message);
}, this, {
message: "Hello World"
});