restore support for string ui.toPage in pagebeforechange events #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I see why you disabled support for ui.toPage being a string in pagebeforechange events - but this is actually my primary use case for jQM router. I've been building a custom jQM-based offline-capable web app framework called wq.app. wq.app includes the ability to automatically render and inject pages offline in response to URL changes, via cached JSON objects and interned Mustache templates. My bC callback (
pages.register
/pages.go
in pages.js) responds to pagebeforechange events by rendering and injecting pages into the DOM - so I don't need the actual page object in my case (since I know it doesn't exist yet).I understand that this might be a case for implementing my own pagebeforechange handler, but I really would like to take advantage of jQM router's URL matching capabilities, since I am registering multiple URL-specific callbacks to handle template selection and context generation.
This pull request restores support for string ui.toPage in bC events to jQM router, with the understanding that the page object may not be defined in this case. Since this is somewhat advanced and may not apply to everyone, I added a configuration option to enable this behavior and set it to false by default. I called the new option "bCAllowStringPage", though I'm certainly open to suggestions for a better name.