File tree 2 files changed +3
-6
lines changed 2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change 1
1
import $ from 'jquery' ;
2
2
import { GET } from '../modules/fetch.js' ;
3
- import { toggleElem } from '../utils/dom.js' ;
3
+ import { elementsCall , toggleElem } from '../utils/dom.js' ;
4
4
5
5
const { appSubUrl, notificationSettings, assetVersionEncoded} = window . config ;
6
6
let notificationSequenceNumber = 0 ;
@@ -179,10 +179,7 @@ async function updateNotificationCount() {
179
179
const data = await response . json ( ) ;
180
180
181
181
toggleElem ( '.notification_count' , data . new !== 0 ) ;
182
-
183
- for ( const el of document . getElementsByClassName ( 'notification_count' ) ) {
184
- el . textContent = `${ data . new } ` ;
185
- }
182
+ elementsCall ( '.notification_count' , ( el ) => el . textContent = `${ data . new } ` ) ;
186
183
187
184
return `${ data . new } ` ;
188
185
} catch ( error ) {
Original file line number Diff line number Diff line change 1
1
import { debounce } from 'throttle-debounce' ;
2
2
3
- function elementsCall ( el , func , ...args ) {
3
+ export function elementsCall ( el , func , ...args ) {
4
4
if ( typeof el === 'string' || el instanceof String ) {
5
5
el = document . querySelectorAll ( el ) ;
6
6
}
You can’t perform that action at this time.
0 commit comments