Skip to content

Commit 736fc50

Browse files
committed
refactor(sidebar.js): ps minor cleanup
1 parent d237384 commit 736fc50

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

js/src/sidebar.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ const Sidebar = (($) => {
9494

9595
perfectScrollbar(event) {
9696
if (typeof PerfectScrollbar !== 'undefined') {
97-
if (event === Event.INIT && !document.body.classList.contains(ClassName.SIDEBAR_MINIMIZED)) {
97+
const classList = document.body.classList
98+
if (event === Event.INIT && !classList.contains(ClassName.SIDEBAR_MINIMIZED)) {
9899
this.ps = this.makeScrollbar()
99100
}
100101

@@ -103,14 +104,15 @@ const Sidebar = (($) => {
103104
}
104105

105106
if (event === Event.TOGGLE) {
106-
if (document.body.classList.contains(ClassName.SIDEBAR_MINIMIZED)) {
107+
if (classList.contains(ClassName.SIDEBAR_MINIMIZED)) {
107108
this.destroyScrollbar()
108109
} else {
110+
this.destroyScrollbar()
109111
this.ps = this.makeScrollbar()
110112
}
111113
}
112114

113-
if (event === Event.UPDATE && !document.body.classList.contains(ClassName.SIDEBAR_MINIMIZED)) {
115+
if (event === Event.UPDATE && !classList.contains(ClassName.SIDEBAR_MINIMIZED)) {
114116
// ToDo: Add smooth transition
115117
setTimeout(() => {
116118
this.destroyScrollbar()

0 commit comments

Comments
 (0)