Variables and properties on objects are different things. You cannot access the property of an object without specifying which object you mean.
You can probably access it using the this
keyword:
this.query();
Keeping in mind that the value of this
will vary depending on how the function is called (when a.b.c.d.AccDocs.deleteAndQuery()
is called, this
inside deleteAndQuery
will be AccDocs
as it is the first object to the left of the last .
, but if you were to first copy query
to another variable and then call query()
, pass it to setTimeout
, or if you were to use call
or apply
then the value of this
would change).
For more robustness (but less flexibility, since being able to change the context can be useful) you can store your object in a variable which you can access by name.
var AccDocs = {
query: function() {
...
},
deleteAndQuery: function() {
...
AccDocs.query();
}
};
return { AccDocs: AccDocs };