K
K
Kilai2013-12-12 03:43:31
Mootools
Kilai, 2013-12-12 03:43:31

Mootools+node.js classes and inheritance

Good afternoon.
Faced this difficulty when using mootools and node.js together. There are two classes:
first

require('mootools');

module.exports = Class({
    coreLink: null,
    initialize: function (core) {
        this.coreLink = core;
    },
    get: function (objName) {
        if (null != this.coreLink.[objName]) {
            return this.coreLink.[objName];
        }
        else {
            return undefined;
        }
    }
});

and second
var Class1= require('./Class1');
module.exports = Class({
    Implements: [Class1],
    initialize: function (core) {
        this.coreLink = core;
    },
    start: function () {
    // ...
      this.get('name');
    // ...
    }
});

But when calling the corresponding method
var Class2= require('./Class2');
var obj = new Class2({name: 'value'});
obj.start();

getting error "TypeError: Object [object Object] has no method 'get'"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question