I'm trying to return an instance of a new Javascript class (not a BB model) from a module. I need to pass arguments in during construction and I'm not sure how.
Here is the module...
define(function (require) {
var $ = require('jquery'),
_ = require('underscore'),
Backbone = require('backbone'),
PhotosCollection = require('collections/PhotosCollection');
return function (el,member,query) {
nameOfClass: 'PhotoTab',
el: el,
member: member,
query: query,
photos: null,
loaded: false,
load: function () {
...
...
So then in another view I'm trying to create and instance like...
createTab: function (tab,elSelector) {
if (!this.photoTab[tab]) {
this.photoTab[tab] = new PhotoTab(
elSelector,
this.member,
"photos-" + tab + "-by-memberId"
);
// Store a reference to every tab
this.photoTabs.push(this.photoTab[tab]);
}
return _t.photoTab[tab];
},
The error occurs on the line el: el,
, Uncaught SyntaxError: Unexpected identifier.
I'm assuming I have most of this put together Ok, I just don't know how to pass args in during the class create/construction. What am I doing wrong?
Thanks for your help :-)