Giter Site home page Giter Site logo

backstack's People

Contributors

pwalczyszyn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backstack's Issues

Feature - Add "StackEffect" to Effects

Hi guys,

Has anyone implemented a "Stack" effect, please share your code. Instead of "sliding", I'd like the Views to come in from the right and stack on top, and slide out to the right when popped.

Thanks,

A.

Views leaving the stack unexpectedly

Code is in this gist.
When the "Notes" link is clicked, the notes template is loaded and is visible for about half a second, then the view changes to solid white.
At this point stackNavigator.viewsStack consists of 3 objects:
[0].instance.el = "html div element" with innerHTML of <div id="container">Notes are here</div>

[1].instance = null

[2].instance.el = "html div element" with innerHTML of <div id="container">Notes are here</div>

No errors are raised at any point, the view just simply disappears.
I should point out that the issue occurs whether I am viewing the page in Chrome or in my PhoneGap application in the iOS Simulator.

viewChanging and viewChanged are only fired a single time when "Notes" link is clicked.
If I apply an effect like

var fade = new BackStack.FadeEffect();
stackNavigator.pushView(new NotesPage({}), {}, fade);

The affect actually occurs as the NotesPage is (incorrectly) disappearing, NOT as it is appearing.

After pushView the content dosnt scroll verticaly ...

Hello,
I wuld like to ask for a hint. I'm using the backstack with trigger.io for mobile app (testing currfently on android phone) and have problem that I cant resolve. I have a list of products iwant display using BackStack pushView(). Prodocts displays correctly but the view doesnt scroll verticaly (and it should because I have many products/items). When I dont use Backstack and just replace the container div with the same html as used with back stack, the scroll bar appears correcly. Is there something I miss?

Thank you ...

Cache views for re-use

I think it will be useful to have some kind of caching, to re-use already rendered views. For example, I use the following function to cache my templates, maybe you can add something similar? (of course minus the template stuff). Great job on the window stack btw!

var TemplateCache = {
          get: function(id,view){
            if (!this.templates){ this.templates = {}; }

            var template = this.templates[id];
            if (!template){
              template = view;

              // precompile the template, for underscore.js templates
             // template = _.template(template);

              this.templates[id] = template;
            }

            return template;
          }
}

I then call this.$el.append(TemplateCache.get("#list-item"));

Calling popView when there are no views to pop breaks BackStack

When I called popView one too many times I got the error 'Error: Popping from an empty stack!' which is correct as I didn't have any views left; but if you try to pushView a new view after having gotten that error it will not push the new view at all, you need to re-instatiate BackStack in order to make it work and use it again.

webkitTransitionEnd didn't trigger in time

I've added a "Tab Bar" to my project and it has introduced a bug.
Let's take for example a Tab Bar like this:

  • Home
  • Notes
  • Tasks

Home and Notes are a single page. Tasks has a button to "View Task" which takes you to a second View (ViewTask).

When any Tab Bar item is clicked, I want the StackNavigator.viewsStack to have only the new page in it. If you are on "Notes" and click "Home", when the page shows ONLY "Home" should be in the viewsStack.
I accomplished this with a simple piece of code:

while(stackNavigator.viewsStack.length > 2) {
                var item = stackNavigator.viewsStack.pop();
            }

I used "length > 2" because there seems to always be a null instance at viewsStack[0] so this would leave at least 1 item there (the current View) before calling replaceView to switch to the new View.

Functionally, it works perfect, except if I am 2 Views deep (say inside Tasks --> ViewTask) the current View (ViewTask in this case) doesn't go away, the new View just renders over the top of it and Console displays the error "webkitTransitionEnd didn't trigger in time".

If I use popAll() or replaceAll() I get an error about "cannot call method 'trigger' of null" at Backstack line 606.

popView is actually a new view?

When I do pushView, then on that new view I do popView, the old view does not have the data that was previously assigned to it.

For example in View1 during Init I populate "this.model" and use it during "this.render". It works fine when I come in with pushView (and pass in options).
When I do popView from View2, suddenly View1 doesn't have any "this.options" and "this.model" cannot be set properly.

This feels like a bug as I won't always have access to the information I need when I am doing a popView….since I am only trying to go Back.

The whole concept breaks when creating View instantions with different datasets

If you are using Backstack like me and you are planning to instantiate Views with different Collections(so not the same instantion over the whole app) be careful to use this because it's gonna render your views multiple times and will also execute other events/functions multiple times. A total nightmare.. So be careful

StackNavigator View instances don't retain custom properties of Views?

Quick example:

var View1 = new Backbone.View.extend({
   initialize: function() {
      this.title = "View 1";
   }
};

var View2 = new Backbone.View.extend({
   initialize: function() {
      this.options.title = "View 2";
   }
}

navigator.pushView(View2);
navigator.pushView(View1);

At this point if you examine navigator.viewsStack you will see that "View2" has "options.title" set, but "View1" does not have "title" set.
Obviously I can use "options" if I need to but to have to set options on every value I want to be useable from my StackNavigator instance seems a bit excessive.

User Backstack with backbone-boilerplate?

Hey,
I tried do use backstack with bbb (https://github.com/tbranyen/backbone-boilerplate) but i got lot's or conflicts when i try to import backstack with requirejs.

I tried' to rewrite the header of the plugin (as backbone.layoutmanager does)

(function(window) {
    "use strict";

    // Alias the libraries from the global object.
    var Backbone = window.Backbone;
    var _ = window._;
    var $ = window.$;

}(this, function ($, _, Backbone) {
.....

But Now I get this error:
Uncaught TypeError: Cannot read property 'StackNavigator' of undefined

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.