(function () {
var logger = Ext.create('Ext.Component', {
xtype: 'widget.console',
renderTo: Ext.getBody(),
autoEl: 'ol',
autoRender: true,
log: function (msg) {
var el = this.getEl(),
dh;
dh = {
tag: 'li',
html: msg
};
el.appendChild(dh);
}
});
Ext.define('Foo', {
extend: 'Ext.Component',
xtype: 'widget.foo',
renderTo: Ext.getBody(),
autoRender: true,
baseCls: 'x-foo',
renderTpl: '<span>{foo:htmlEncode}</span>',
config: {
// not sure why this is getting overwritten
foo: 'moo moo'
},
listeners: {
// is there a change event or config change event?
foochange: function (cmp, newValue, oldValue) {
var el = cmp.getEl(),
tpl = cmp.renderTpl;
logger.log('foo changed from ' + oldValue + ' to ' + newValue);
el.setHTML(tpl.apply(cmp));
// bubble, relay, something else to send change event?
},
change: function (cmp) {
logger.log('change');
}
},
constructor: function (config) {
this.initConfig(config);
this.callParent([config]);
},
// this is like a validator/setter in YUI
applyFoo: function (foo) {
logger.log('applying ' + foo);
return foo;
},
updateFoo: function (newValue, oldValue) {
logger.log('updating foo from ' + oldValue + ' to ' + newValue);
// can we tell if we are in the init phase?
if (newValue !== oldValue) {
logger.log('newValue !== oldValue');
// this is like broacast: 1 in YUI
this.fireEvent('foochange', this,...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.