I have an object:
var long_object_name = {
'init':function(){
this.properties.the_screen_size[0] = window.innerWidth;
this.properties.the_screen_size[1] = window.innerHeight;
window.addEventListener('resize', function(){
long_object_name.properties.the_screen_size[0] = window.innerWidth;
long_object_name.properties.the_screen_size[1] = window.innerHeight;
}, false);
},
'properties':{
'the_screen_size':[]
}
}
So I want to store the screen size in a variable that changes when the user changes the window size.
The problem is that in the re-size event function I’ve to type the "long_object_name" to “reach” the "properties" object. So my question is, is there any way to “reach” the "properties" object in another way, e.g. like this.properties but this doesn’t work in this case, right?
1 Answer