- About
- License
- Installation
- Examples
- Author
JSDIAAL' s part in your web application: check if a requested resource exists, load it if not, instantiate or return an already instantiated class.
Sound difficult? Nope.
There are a couple of great JavaScript frameworks out there. And jQuery. I really hate jQuery. Why? Ever tried to declare classes, interfaces, abstracts, inheritance with jQuery without another framework? Jepp, that's why joii!If you are in the lucky position to have MooTools or another great JavaScript framework, ignore joii yet. But take a look later!!
MIT, general free, use it, extend it, love it
First of all, include the needed files.
< script src="js/vendor/joii/joii.js"></script>
< script src="js/vendor/joii/plugins/joii.mixin.js"></script><br />
< script src="js/configuration/dependency.js"></script><br />
< script src="js/MyLib/Dependency.js"></script><br />
< script src="js/Application.js"></script><br />
The rest does JSDIAAL for you!
almost...
Make sure, all declared classes have dedicated files.
Your declared a class MyLib_Foo_Bar? Put it under /js/MyLib/Foo/Bar.js!
If you have it somewhere other than js/, change MyLib/Dependency.js...
var dependencyConfiguration = {
foobar: { // name of your dependency
shared: true, // share this if instantiated!
className: 'MyLib_Foobar' // which class is meant?
},
pewpew: {
shared: false, // always create a fresh instance!
className: 'MyLib_PewPew' //
},
user: {
shared: false,
className: 'MyLib_Model_User'
}
};
var dependency = null;
If document is fully loaded, instantiate the dependency class:
window.addEventListener('load', function(){
dependency = new MyLib_Dependency();
});
Now JSDIALL is ready to use:
dependency.getPewPew().cathew()
dependency.getPewPew().getCounter()
dependency.getFoobar().doFoo()
dependency.getFoobar().getCounter()
See index.html for a full example! Have an eye on FireBug or whatever shows you the loaded files and JavaScript console ;)
- wolxXx
- born in early january 1985
- living in Dessau - Germany | working in Berlin - Germany
- https://wolxxx.de
- devops@wolxXx.de
- https://git.wolxxx.de
- https://github.com/wolxXx