smoke.js icon indicating copy to clipboard operation
smoke.js copied to clipboard

Destroy all modals

Open dennismonsewicz opened this issue 9 years ago • 1 comments

Reworked destroy method to be a little more global, so it can be called by itself from the smoke object. The use case was if using the smoke library with the routing system inside of Backbone. If a user navigates to a route, then proceeds to click the back button in the browser and a smoke modal is open, the modal doesn't close.

Here is how you can get around the issue with Backbone.Router and the changes in this PR:

Backbone.Router.extend({
  execute: function(callback, args) {
    // make sure smoke object is present
    if(smoke.newid) {
        smoke.destroy();   
    }

    if (callback) callback.apply(this, args);
  },

  // other codez
});

dennismonsewicz avatar Apr 28 '15 19:04 dennismonsewicz

:+1:

trey avatar Apr 28 '15 19:04 trey