How to add functions between redirections

28 views
Skip to first unread message

baihe chou

unread,
Sep 1, 2014, 6:28:21 AM9/1/14
to zomb...@googlegroups.com
Use case:  I open page A, and submit form, and would redirect to B, and auto redirect to C, and then if no action performed, to D automatically. I need to do something in B, C, D, How to do it in callbacks, or in promises?

I want to extract some contents in B when fetching it, and after that, B will auto redirect to C, and I want to extract contents from C, and wait several seconds, after D is fetched, I would do something to D using the contents extracted from B and C.
I know how to write the logic, but I don't know how to compose them in callbacks or promises, promise way is preferred.

Thanks!

Assaf Arkin

unread,
Sep 1, 2014, 6:12:30 PM9/1/14
to zomb...@googlegroups.com


--
You received this message because you are subscribed to the Google Groups "zombie.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zombie-js+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

baihe chou

unread,
Sep 2, 2014, 5:57:39 AM9/2/14
to zomb...@googlegroups.com
Hi:
Thanks to your reply.
I did this in PhantomJs, using the event way, listening to pages and resources loading.
But this will make the logic fragmented, so I want to know if there is a way to write the logic in a flow style, using callbacks or wait/action way.

Thanks

Assaf Arkin

unread,
Sep 2, 2014, 1:56:40 PM9/2/14
to zomb...@googlegroups.com, zomb...@googlegroups.com
This is the core API, if you want a different abstraction for using it, why not write one that works for you?
Reply all
Reply to author
Forward
0 new messages