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

Generate new fresh instance of library #31

Merged
merged 2 commits into from
Jul 12, 2017
Merged

Conversation

laander
Copy link
Contributor

@laander laander commented Jul 11, 2017

Motivation

There's an leaking issue when using multiple instances of the library on the same page, where config settings differ (app, user auth etc). The reason is that when the library is required through DI, a singleton is always returned which means multiple SDK instances can't be used on the same page/script.

This PR adds a new method newInstance that simply returns a new instance of the SDK class.

Design choices

Instead of changing the default module.export behaviour and thus breaking backwards compatibility, we just added a new optional method that can be used instead.

Tests

Added one test.

Related dependencies

timekit-io/booking-js#152

Who should review it

@Trolzie

@Trolzie
Copy link
Contributor

Trolzie commented Jul 11, 2017

♠️

@laander laander merged commit ead1d78 into master Jul 12, 2017
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