What's this ?

Tank is an experimental library targeted to simplify js code from complex function annidation through dom and XHR requests event triggering

Why?

Purpose of this tiny lightweight and simple library is to simplify the job with your js projects without having to include tons of js frameworks. The underlying philosophy is that each functionality must be a brick for another one, splitting the complexity into simple flow instructions.

What?

Tank is just born and offers a minimal and a'beta' set of utility methods to manipulate dom and inject dynamically html elements, scripts and stylesheets, perform XHR get and post requests with parameter substitution, modify elements css. Help and feedbacks are very appreciated, so send me a mail or contribute to improve the project on gitHub The library is not designed for old browser, it is tested to work with modern html5 compatible browsers:

Leaning only to the latest specifications of HTML5 (no JQuery or other facilities) Tank provides a single direct access point, the function
        Tank.define({});
Every property you put inside the object is threated and evaluated as a resorce globally or locally defined you can do something like this:
        Tank.define({
            stylesheet: { File: { url: '/path/to/your/css/style.css' } }
        });
or get multiple requests and then log a message
        Tank.define({
            get: {
                Request: {url: "/customerProducts.json?id={{=custId}}" }
                log: { Log: "request completed" }
            }
        });
Tank can be extended, putting methods inside the flow using the method "extend", globally (and they will be available to other flows) or locally (available since they are defined till the end of the flow).
        Tank.define({
            aLocalDefinedFunction: {},
            extend: {
                Global {
                    globalScopedProp: "aLocalDefinedPropertyVal",
                    globalScopedFunction: function (anyGlobalProp) {
                        console.log(anyGlobalProp);
                    }
                },
                Local: {
                    aLocalDefinedProperty: "aLocalDefinedPropertyVal",
                    aLocalDefinedFunction: function (aLocalDefinedProperty) {
                        console.log(aLocalDefinedProperty);
                    }
                }
        });
When executing this code block, first of all Tank will call the 'extend' function and collect new definitions, then runs the "aLocalDefinedFunction" and the output will be "aLocalDefinedPropertyVal" in your js console.

Live demos