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

Change the api to "extend" syntax #35

Merged
merged 9 commits into from
Sep 26, 2018
Merged

Change the api to "extend" syntax #35

merged 9 commits into from
Sep 26, 2018

Conversation

nataly87s
Copy link
Contributor

this makes the api more "functional", and makes adding extension methods easier - no need to change the dispatcher prototype

Copy link
Contributor

@AvivRubys AvivRubys left a comment

Choose a reason for hiding this comment

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

I'm in Romania so I didn't go through it thoroughly, but a few things:

  1. This is a huge breaking change, so it needs a major version bump IMO, even if we are on 0.x
  2. Is the breaking change worth it? Maybe we can create a version that supports both APIs and start with incremental changes? Otherwise big projects will never be migrated. (Unless - wanna write a codemod?)

Copy link
Contributor

@AvivRubys AvivRubys left a comment

Choose a reason for hiding this comment

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

We should also take the old tests and turn them into legacySupport tests

var extender = extenders[name];

AnalyticsDispatcher.prototype[name] = function () {
console.warn('AnalyticsDispatcher.' + name + ' is deprecated, use AnalyticsDispatcher.extend('+name+'(arguments)) instead');
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a boolean or something to only warn once (maybe once per extender)? Otherwise it will spam the console.
And disable logging in production

@@ -1,6 +1,6 @@
{
"name": "shisell",
"version": "0.4.1",
"version": "0.5.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's bump this to 1.0.0?

index.d.ts Outdated
export class AnalyticsDispatcher {
constructor(dispatch: DispatchAnalytics, context?: AnalyticsContext);
withContext(context: AnalyticsContext): AnalyticsDispatcher;
Copy link
Contributor

Choose a reason for hiding this comment

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

These types need to remain somehow for legacy support

@nataly87s nataly87s merged commit ffd7651 into master Sep 26, 2018
@nataly87s nataly87s deleted the extend-syntax branch September 26, 2018 11:40
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.

2 participants