Skip to content

Commit 448033b

Browse files
committed
feat: Further plugins work
1 parent ec6160c commit 448033b

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/install.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export default function (_Vue, opts = {}) {
5050
})
5151
}
5252
if (opts.plugins) {
53+
// required plugin
5354
Platform.install({ Quasar })
55+
5456
Object.keys(opts.plugins).forEach(key => {
5557
const p = opts.plugins[key]
5658
if (typeof p.install === 'function') {

src/plugins.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import AppFullscreen from './plugins/app-fullscreen'
33
import AppVisibility from './plugins/app-visibility'
44
import Cookies from './plugins/cookies'
55
import Platform from './plugins/platform'
6-
import WebStorage from './plugins/web-storage'
6+
import { LocalStorage, SessionStorage } from './plugins/web-storage'
77

88
export {
99
AddressbarColor,
1010
AppFullscreen,
1111
AppVisibility,
1212
Cookies,
1313
Platform,
14-
WebStorage
14+
LocalStorage,
15+
SessionStorage
1516
}

src/plugins/web-storage.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,15 @@ export const LocalStorage = {
160160
set: setStorageItem.local,
161161
remove: removeStorageItem.local,
162162
clear: clearStorage.local,
163-
isEmpty: storageIsEmpty.local
163+
isEmpty: storageIsEmpty.local,
164+
165+
__installed: false,
166+
install ({ Quasar }) {
167+
if (this.__installed) { return }
168+
this.__installed = true
169+
170+
Quasar.localStorage = LocalStorage
171+
}
164172
}
165173

166174
export const SessionStorage = {
@@ -174,16 +182,13 @@ export const SessionStorage = {
174182
set: setStorageItem.session,
175183
remove: removeStorageItem.session,
176184
clear: clearStorage.session,
177-
isEmpty: storageIsEmpty.session
178-
}
185+
isEmpty: storageIsEmpty.session,
179186

180-
export default {
181187
__installed: false,
182188
install ({ Quasar }) {
183189
if (this.__installed) { return }
184190
this.__installed = true
185191

186192
Quasar.sessionStorage = SessionStorage
187-
Quasar.localStorage = LocalStorage
188193
}
189194
}

0 commit comments

Comments
 (0)