Giter Site home page Giter Site logo

Comments (4)

mxriverlynn avatar mxriverlynn commented on May 3, 2024

eval is the devil! :)

how about specifying it as a function? I use that a lot when I have code that can't be evaluated immediately. It would look something like this:

Backbone.Marionette.CollectionView.extend({
  itemView: function(){
    return MyItemView;
  }
});

where MyItemView is defined in another file somewhere else.

This would be easy to implement and should work for you.

from backbone.marionette.

ansman avatar ansman commented on May 3, 2024

I know :(

The problem is how would you separate a function from a class?

from backbone.marionette.

mxriverlynn avatar mxriverlynn commented on May 3, 2024

... right... that's a very good question. I'll have to think about this some more.

from backbone.marionette.

mxriverlynn avatar mxriverlynn commented on May 3, 2024

Having thought about this for a bit, I'm going to have to say no to the request. There is a working solution that you've pointed out in another ticket (and that I'm currently using in several places as well): use the initialize function and set the collection / model from within that. I know this isn't a great solution, but at this point I can't see a better way to make this happen.

There's no way to tell if a function is meant to be a constructor function or just a regular function, so I can't do anything a long those lines.

There are too many security, performance and other practical issues with using eval, so I can't do anything along those lines either.

Closing this as "won't fix", unless someone can point out a way to make something other than eval work, easily.

from backbone.marionette.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.