1

I have a file (a.js) where is defined a constructor like this:

var Gauge = function( config) {
    Gauge.Collection.push( this);

    /**
     *  Default gauge configuration
     *  @struct
     */
    this.config = {
        renderTo         : null,

and also several functions. I would like to create that object from an other file and then call functions in it. How can I do it?

Thanks

Edge7
  • 681
  • 1
  • 15
  • 35

2 Answers2

1

What about:

myGauge = new Gauge();

If this doesn't match to your pattern, take a look at differnent Javascript OOP patterns, e.q. in this thread.

If my answer doesn't help, please post more code, e.q. on jsfiddle.net.

Community
  • 1
  • 1
Mr. B.
  • 8,041
  • 14
  • 67
  • 117
0

I am pretty sure that all you need to do is to make sure that a.js is loaded before the file that you will be using to instantiate Gauge.

2ps
  • 15,099
  • 2
  • 27
  • 47
willascend
  • 1,503
  • 8
  • 15