0

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 :-)

Locohost
  • 1,682
  • 5
  • 25
  • 38
  • This SO post helped me resolve... This SO post helped me resolve... http://stackoverflow.com/questions/4869530/requirejs-how-to-define-modules-that-contain-a-single-class – Locohost Nov 06 '13 at 01:14

1 Answers1

0

This SO post helped me resolve...

RequireJS: How to define modules that contain a single "class"?

I need to refer to the class attribs like: this.nameOfClass, this.el, this.member and so on.

Dumb mistake :-/

Community
  • 1
  • 1
Locohost
  • 1,682
  • 5
  • 25
  • 38