Open vibhu-imaginea opened 7 years ago
Hi,
did you manage to solve this issue ? I'm having the same issue...
Even though the docs say enjoyhint_instance.trigger('custom_event_name');
should work, I'm looking at the source code and it appears that the only values that will do something are trigger('next)
and trigger('skip')
. So the way I got a "custom" event to work was to set the event to custom
and then calling enjoyhint_instance.trigger('next')
when appropriate.
e.g.
var enjoyhint_script_steps = [
{
'custom .new_btn' : 'Waiting for a custom event to trigger'
}
];
function iAmReady()
{
enjoyhint_instance.trigger('next');
}
Hope that helps
jagers it right about the code only run with 2 case ('next' and 'skip') in trigger event.
I came up with the solutions add custom case to trigger event and run to next step with nextStep() function.
that.trigger = function (event_name) { switch (event_name) { case 'next': nextStep(); break case 'skip': skipAll(); break default : nextStep(); break; } };
Hope this help.
Still experience this issue. Any way to jump to a specific step based on trigger?
I've got custom steps working in this fork: https://github.com/darron1217/enjoyhint.js It's a bit different so be sure to look at the example I put in that README
As far as skipping to a specific step give me until tomorrow and I can post the changes I had to make on the project I'm working on. It requires some specific changes to the rerunscript function
Any update on skipping to a specific step?
My pull request https://github.com/xbsoftware/enjoyhint/pull/103 Has rerunscript(step) working correctly.
Awesome thank you. I see it hasn't been merged into xbsoftware/enjoyhint. Is there a repo I can pull to get these latest changes?
I have a series of steps (say 5 steps), last two of which are asynchronous. So, I am giving custom event for last two steps. Now, I am not able to trigger the last two steps manually. Also I am getting the 4th step which should not be triggered until triggered manually. Any idea? The error I get after 4th step is rendered is:
Here is the sample steps config:
var enjoyhint_script_steps = [{ "click #btn1": "Some Instruction.", "showSkip": showSkip, "showNext": showNext }, { "click [name='btn2']": "Some Instruction", "showSkip": showSkip, "showNext": showNext }, { "click .btn3": "Some Instruction", "showSkip": showSkip, "showNext": showNext }, { "event_type": "custom", "event": "my-custom-event1", "selector": "[name='btn4']", "description": "Some thing here", "showSkip": showSkip, "showNext": showNext }, { "event_type": "custom", "event": "my-custom-event2", "selector": "[name='btn5']", "description": "More instructions", "showSkip": showSkip, "showNext": showNext }];
var enjoyhint_instance = new EnjoyHint({});
enjoyhint_instance.set(enjoyhint_script_steps);
enjoyhint_instance.run();
showSkip
andshowNext
are boolean variables set to false.This is how I am triggering custom events on some event:
enjoyhint_instance.trigger('my-custom-event1');