kryo
13 May 2011, 9:07 PM
This is a new component I put together, which allows you to modularize your application by using bootstraps. I couldn't find a built-in way of loading javascript and/or css on the fly, so I put this together. I've seen a few other extensions out there, but nothing geared for ExtJS 4 or that allowed dynamic css loading.
Here is a simple example of what a bootstrap looks like, it should give you an idea of what can be done with it.
Ext.create( 'Ext.Bootstrap', {
js: [
'js/some-script-1.js',
'js/some-script-2.js'
],
css: [
'css/some-script-1.css',
'css/some-script-2.css'
],
init: function(){
// here goes code to be executed after the above scripts are loaded.
}
});Example, and documentation is included in the downloadable zip file. Online demo is available here (http://jsfiddle.net/PSH5N/). Feel free to comment if you have any questions or suggestions.
Note, you may have issues running the demo example directly without a web server. This is because Javascript (js/example.js) is loaded by Ext.Ajax, and the browser tries to access it by it's URL form (file:///path/to/js/example.js) which it not allowed because of XSS. This is a security feature of most recent browsers. (Any fix for that?)
News:
06.01.2011 - Created 1.0 release - Enables script caching and is tested & bundled with ExtJs 4.0.1 minified.
05.15.2011 - Updated 0.1rc tarball. Another bug found, js and css configs should be array by default, not null.
05.14.2011 - Updated 0.1rc tarball. Encountered a big bug when multiple bootstraps are used at the same time. Asynchronous javascript requests were leaking between bootstrap instances. This is now resolved.
05.14.2011 - Updated 0.1rc tarball. Encountered a bug with event listeners assigned from configuration. This is now resolved.
Here is a simple example of what a bootstrap looks like, it should give you an idea of what can be done with it.
Ext.create( 'Ext.Bootstrap', {
js: [
'js/some-script-1.js',
'js/some-script-2.js'
],
css: [
'css/some-script-1.css',
'css/some-script-2.css'
],
init: function(){
// here goes code to be executed after the above scripts are loaded.
}
});Example, and documentation is included in the downloadable zip file. Online demo is available here (http://jsfiddle.net/PSH5N/). Feel free to comment if you have any questions or suggestions.
Note, you may have issues running the demo example directly without a web server. This is because Javascript (js/example.js) is loaded by Ext.Ajax, and the browser tries to access it by it's URL form (file:///path/to/js/example.js) which it not allowed because of XSS. This is a security feature of most recent browsers. (Any fix for that?)
News:
06.01.2011 - Created 1.0 release - Enables script caching and is tested & bundled with ExtJs 4.0.1 minified.
05.15.2011 - Updated 0.1rc tarball. Another bug found, js and css configs should be array by default, not null.
05.14.2011 - Updated 0.1rc tarball. Encountered a big bug when multiple bootstraps are used at the same time. Asynchronous javascript requests were leaking between bootstrap instances. This is now resolved.
05.14.2011 - Updated 0.1rc tarball. Encountered a bug with event listeners assigned from configuration. This is now resolved.