-
Notifications
You must be signed in to change notification settings - Fork 3
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
Conversation
e912f22
to
409b6db
Compare
409b6db
to
986abc6
Compare
There was a problem hiding this 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:
- This is a huge breaking change, so it needs a major version bump IMO, even if we are on 0.x
- 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?)
There was a problem hiding this 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
lib/legacySupport.js
Outdated
var extender = extenders[name]; | ||
|
||
AnalyticsDispatcher.prototype[name] = function () { | ||
console.warn('AnalyticsDispatcher.' + name + ' is deprecated, use AnalyticsDispatcher.extend('+name+'(arguments)) instead'); |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
this makes the api more "functional", and makes adding extension methods easier - no need to change the dispatcher prototype