Android OS architecture
I am just sharing a picture which explains well the architecture of android OS.
courtesy: datasprings.com
I am just sharing a picture which explains well the architecture of android OS.
courtesy: datasprings.com
Lets see how can we write JavaScript object oriented with a simple example.
(function(){
// Initialize namespace
window.foo = window.foo || {};
// create a class named alerts for foo
foo.alerts = (function() {
// here you can write the constructor stuffs
var windowAlert = "this is window alert"; //instance variable
var anchorAlert = "you clicked on anchor tag"; //instance variable
return {
// write member functions here
showWindowAlert : function() {
// this is a member function
// and can be called as foo.alerts.showWindowAlert();
alert(this.windowAlert);
},
showAnchorAlert : function() {
// this is anoter member function
alert(this.anchorAlert);
}
};
})();
})();This JavaScript will be called in page load. To call fist member function showWindowAlert(), you have to call like this,
foo.alerts.showWindowAlert();
The second function showAnchorAlert() can be called like this,
foo.alerts.showAnchorAlert();