javascript - Calling a mootools class method from another external function -


I have a legacy Mutulus class, which I am using in many tasks. Rather than expanding the classroom, I am trying to call only one of the class methods out of class. So if the class has seen something like this:

  var myClass = new class ({search: function () {this.searchSpinner.show (); this.request.send ({data: this .data});}, // many other functions})   

I have to call the search method from other scripts loaded on the same page.

I'm just trying this way:

  window.myClass.search ();   

But this is the result of a big hairy error that I can not understand, but that looks:

  Unkit type error: object function () {E (this); If (G. prototyping) {return;} it. $ Caller = null; Var i = (this.initialize)? Initialize it. Aponley (this, argument): this, it. $ Collar = this.caller = null; There is no way 'search' in return I;}   

Is there a 'right' way to call this method?

A class defined by the use of Mootool's class behaves like a static In other languages, in order to reach the classes in that class, you must first create an example of that class:

  var classObj = new myClass (/ * if any parameter is required , "Start" method * /); ClassObj.search ();    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -