Code Monkey home page Code Monkey logo

Comments (5)

thomasdavis avatar thomasdavis commented on June 26, 2024

So if you create a view called 'SomeViewLabel' and then try create another view with the name 'SomeViewLabel' what will happen is that the first one you created will unbind any events attached to it before it overrides itself with the new one.

Does this make any sense?

from backboneboilerplate.

chchrist avatar chchrist commented on June 26, 2024

Ah OK , yes it makes sense, but what would be great is to be able to be at viewone and when you go to viewtwo to unbind the events or other stuff from viewone. Let's say my viewone has a var tick = setInterval() I want to be able to cleatInterval(tick) before I open the viewtwo.

from backboneboilerplate.

hansgill avatar hansgill commented on June 26, 2024

Hi thomas,

trying to understand why we would want to keep the views around and then remove them when we are about to create a new view with the same name? Wouldn't it make more sense to follow the path you outline in your tutorials (remove the currentView if there is one and then set the currentView to the new view being displayed) ?

Appreciate your feedback and thoughts.

from backboneboilerplate.

joaovpmamede avatar joaovpmamede commented on June 26, 2024

Shouldn't the "vm" be responsible for calling the "destroy"(unbind and remove view) method on each view that is about to be replaced?
Not sure if you want to have previous created views being "zombies" around your application.

from backboneboilerplate.

arunkjn avatar arunkjn commented on June 26, 2024

I agree with @chchrist. vm should also have a separate destroy logic(along with create), where a view can be explicitly destroyed by passing its name.

from backboneboilerplate.

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.