fortesinformatica / Sideshow

Sideshow is a powerful javascript library which aims to reduce your user's learning curve by providing a way to create step-by-step interactive tours. Explain the features of your application, control your end-user's interaction with your UI, emphasize what you're explaining in each step by masking it. Just think! The sky is the limit!
http://fortesinformatica.github.io/Sideshow
Apache License 2.0
86 stars 31 forks source link

Skipped step still calls beforeListener #17

Closed DanielApt closed 9 years ago

DanielApt commented 9 years ago

Not sure if this is intentional, so maybe I can explain my current situation:

I want to skip a step if the nav is open.

If the nav is closed, I want to toggle the nav, before proceeding.

{
    skipIf: function () {
        // returns true if the nav is open
    },
    title: 'Nav',
    text: 'Lorem ipsum'
    listeners: {
        beforeStep: function () {
            // toggles the nav
        }
    },
    completingConditions: [
        function () {
            // returns if the nav is open
        }
    ]
}

The problem here is that I'm expecting the skipped step not to call its beforeStep handler. Was there a specific reason for always calling the beforeStep handler? I'm happy to hear your thoughts @alcidesqueiroz

alcidesqueiroz commented 9 years ago

@DanielApt indeed, there's no reason for giving a higher precedence to beforeStep event than the skipIf evaluator. I made this change and pushed to develop: bc5f9ef.