Hi, I am trying to pass the interface of a revealing module to another module by passing this to its constructor. I cannot figure out what to pass into the constructor of the presenter module.
Here is the code:
Code://This is like an MVP Presenter which should be created from the view and constructed with the view interface as parameter var AuthorCreatePresenter = function(viewinterface) { var view = viewinterface; console.log(view.test);//This should print 'testing interface of AuthorCreateView' but viewinterface.test is undefined function testfunc() { console.log('testpresenterfunc'); } return { testfunc: testfunc } }; //This is like a MVP View, where the public section is the View Interface var AuthorCreate = function() { //== Private variables == var self = this; var presenter = new AuthorCreatePresenter(self);//I want the presenter to be able to call the public interface like 'view.test' but when running this view.test is undefined presenter.testfunc();//This works fine //== Private functions == //== Public interface == return { test: "testing interface of AuthorCreateView" }; } ();


Reply With Quote

Bookmarks