browser-deeplink
browser-deeplink copied to clipboard
added callback option
In our situation we don't want the user to go the app store but we rather provide custom callback behavior that's called when the app is not found
I also added a trailing ;
after end
in the android url because our Titanium app goes haywire without it.
Also, switched package
and scheme
for same reason
I wasn't aware that when I make subsequent commits after creating a pull request, Github just adds them to the PR. Anyways, this PR gets a bit convoluted like this
Great suggestion. Haven't been able to verify, but code looks like it should do the job :)
However, specifying a callback should perhaps take precedence over fallback link. So I suggest changing the order of the if
statement. What do you think?
if (settings.callback) {
timeout = setTimeout(settings.callback, settings.delay);
} else if (settings.fallback) {
timeout = setTimeout(openAppStore(Date.now()), settings.delay);
}
I had it like that before but I figured I didn't want to overrule current behavior. But now that that's an option, how about we let fallback
take different values:
-
'openAppStore'
, opens app store (default setting, works as it does now) -
false
, don't do anything (works as it does now) -
function() {}
, call this function as a callback
Yep, sounds good!
The open()
function is starting to get a little bloated. Perhaps we can refactor and move the settings.fallback
logic to its own function?
Yeah, good idea!