b0bdN / prayer-times-menubar-app

A menubar application for displaying the prayer times from your city.
MIT License
15 stars 20 forks source link

store.getMidnightMode doesn't get the new value #1

Closed b0bdN closed 2 years ago

b0bdN commented 2 years ago

When I select the parameter MidnightMode in the settings panel and click on Apply, everything updates correctly. But if I want to change later the value (without closing the app), the store.getMidnightMode variable does not change even though the value is updated with store.setMidnightMode.

See main.js:

    // MidnightMode
    const midnightMode = args[15]
    console.log(midnightMode + ' store.getMidnightMode = ' + store.getMidnightMode)
    if (midnightMode !== store.getMidnightMode) {
      changed = true
      console.log('Storage: the parameter midnightMode is different.')
      store.setMidnightMode(midnightMode)
    }

Here is an extract from the terminal for the line console.log(midnightMode + ' store.getMidnightMode = ' + store.getMidnightMode):

store.getMidnightMode stay to 0 even though I just updated to 1 the first time

tikenov commented 2 years ago

Fixed this issue. The problem was that all get parameters returned variables but should be functions. Also replaced setTimeout with await on fetching data.

b0bdN commented 2 years ago

Hi! Thank you for your time! :) I'm new to JavaScript and the syntax async/await is not something I understand completely.. But your answer and modifications are a great help.

tikenov commented 2 years ago

Hi, actually this is my first contribution ever🙂 Hope it was helpful. found by label "good first issue".