Dojo Declare returning This has window

82 Views Asked by At

I'm using dojo declare to build out a presenter file.

In the constructor, I'm passing in params which is an object literal having one attribute called product. Then I have other methods inside of product. When then calling other methods, the this variable is the window instead of the current object.

Below is the code that I'm using:

define([
    'dojo/_base/declare'
], function(declare) {

var ProductComparePresenter = declare("ProductComparePresenter", [], {
    constructor: function(params) {
        declare.safeMixin(this, params);
    },
    monthlyPremium: function() {
        console.log(this.product);
    }
});

return ProductComparePresenter;

});

In this example this is the window and there of course is no product. Is there something I'm overlooking?

Thanks.

0

There are 0 best solutions below