Skip to content

Commit

Permalink
fix singleton pattern cause multiple instances
Browse files Browse the repository at this point in the history
  • Loading branch information
mediv0 committed Jul 27, 2020
1 parent f8e600c commit a904d3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xmodal-vue",
"version": "1.0.1",
"version": "1.0.2",
"private": false,
"description": "🚀 a simplistic and easy to use wrapper around your components that will help you create custom modals, from your components",
"author": "Mahdi Fakhr",
Expand Down
8 changes: 5 additions & 3 deletions src/store.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
class Store {
constructor() {
if (Store.instance == null) {
this.modals = new Map();
if (Store.exists) {
return Store.instance;
}
return Store.instance;
Store.exists = true;
Store.instance = this;
this.modals = new Map();
}

// save new modal in the map
Expand Down

0 comments on commit a904d3e

Please sign in to comment.