First time poster, long time lurker.
I'm trying to learn some more advanced features of .js, and have two ojectives based on the pasted code below:
I would like to add methods to a parent class in a specific way (by invoking prototype).
I intend to update the declared key/value pairs each time I make an associated method call. execMTAction as seen in TheSuper will execute each function call, regardless. This is by design.
Here is the code:
function TheSuper(){
this.options = {componentType: "UITabBar", componentName: "Visual Browser", componentMethod: "select", componentValue: null};
execMTAction(this.options.componentType, this.options.componentName, this.options.componentMethod, this.options.componentValue);
};
TheSuper.prototype.tapUITextView = function(val1, val2){
this.options = {componentType: "UITextView", componentName: val1, componentMethod: "entertext", componentValue: val2};
};
I would like to execute something like this (very simple):
theSuper.executeMTAction();
theSuper.tapUITextView("a", "b");
Unfortunately I am unable to overwrite the "this.options" in the parent, and the .tapUITextView method throws an error saying it cannot find executeMTAction.
All I want to do, like I said, is to update the parameters in the parent, then have executeMTAction run each time I make any method call. That's it. Any thoughts? I understand this is basic but I'm coming from a long-time procedural career and .js seems to have this weird confluence of oo/procedural that I'm having a bit of difficulty with.
Thanks for any input!