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

Add a Radar.clearTripOptions interface #69

Merged

Conversation

jkao
Copy link
Contributor

@jkao jkao commented Jul 14, 2022

No description provided.

@jkao jkao requested a review from corypisano July 14, 2022 18:16
@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #10965: Add a Radar.clearTripOptions interface to radar-sdk-js.

@jkao jkao merged commit 0d94d10 into master Jul 14, 2022
@jkao jkao deleted the radarjeff/sc-10965/add-a-radar-cleartripoptions-interface-to branch July 14, 2022 18:20
Comment on lines 205 to 209
if (!tripOptions) {
Radar.clearTripOptions();
return;
}
Storage.setItem(Storage.TRIP_OPTIONS, JSON.stringify(tripOptions));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would

if (!tripOptions) {
    Storage.setItem(Storage.TRIP_OPTIONS, JSON.stringify(tripOptions));
}

have the same effect, or does explicitly calling Storage.removeItem() have some side effects that need to happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd need to guard against JSON.stringify(null/undefined) in any case.

at the moment, this interface doesn't have a lot of guard rails, so a future iteration could do more type-checking against what tripOptions are and be more precise. this seems reasonable for now.

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

Successfully merging this pull request may close these issues.

None yet

3 participants