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

Unable to specify request options for a particular request without reimplementing all of the "which link clicks should use SPF" logic? #427

Open
wimleers opened this issue Oct 3, 2016 · 0 comments

Comments

@wimleers
Copy link

wimleers commented Oct 3, 2016

nicksay@acf8727 (part of #390) introduced a way for custom request headers to be sent along with a particular request.

Unfortunately, it's not at all trivial to call spf.navigate():

  1. Ideally, you'd be able to listen to the spfrequest event and specify request headers there. But the event doesn't allow me to specify spf.RequestOptions.
  2. Best alternative: cancel/preventDefault() the spfclick event and call spf.navigate() myself. Then I can easily specify spf.RequestOptions. Unfortunately, canceling that event causes the entire page to be reloaded. So, that also doesn't work.
  3. Therefore the only way for me to call spf.navigate() with my desired spf.RequestOptions, is to add my own click handler, but that requires reimplementing all of the logic necessary for determining which clicks to actually handle: spf.nav.handleClick_() and every function that that calls. (I couldn't reuse that function nor any of the functions it calls, because they're marked @private, and the compiled/minified/built/production build of spf.js thus makes them inaccessible.

So:

  1. Did I do something wrong? Happy to hear so!
  2. If I did not do anything wrong: how do you propose I solve this? Would supporting use cases 1 or 2 make sense?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant