Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the callbacks options to accept function name #167

Open
intellisense opened this issue Dec 13, 2013 · 0 comments
Open

Make the callbacks options to accept function name #167

intellisense opened this issue Dec 13, 2013 · 0 comments

Comments

@intellisense
Copy link

I have created a Django application django-joyride on top of this library where joyrides are configurable through admin panel. As now all the configuration is managed through admin, It is necessary that postExposeCallback etc callbacks should accept function name as string:

postExposeCallback: "my_callback_name"

You just need to add below lines in non configurable settings in order to achieve that:

// check if callbacks are passed as string
if (typeof settings.postExposeCallback !== "function"){
    settings.postExposeCallback = window[settings.postExposeCallback];
}
if (typeof settings.preRideCallback !== "function"){
    settings.preRideCallback = window[settings.preRideCallback];
}
if (typeof settings.postRideCallback !== "function"){
    settings.postRideCallback = window[settings.postRideCallback];
}
if (typeof settings.preStepCallback !== "function"){
    settings.preStepCallback = window[settings.preStepCallback];
}
if (typeof settings.postStepCallback !== "function"){
    settings.postStepCallback = window[settings.postStepCallback];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants