Yes, you would do that. And inside the callback, you can check which variable has changed by performing a diff.
Although, this pattern is not really stable. I'd suggest if you're working on something serious and you have a UI framework like Angular or React, then use the underlying APIs to help you perform this action. For example, in React, you can use reducers to make any change to the app state, the app state can be stored in the sessionStorage as well. I've used a similar data flow architecture in my recent open-source app, but with localStorage instead of session.
Yes, you would do that. And inside the callback, you can check which variable has changed by performing a diff.
Although, this pattern is not really stable. I'd suggest if you're working on something serious and you have a UI framework like Angular or React, then use the underlying APIs to help you perform this action. For example, in React, you can use reducers to make any change to the app state, the app state can be stored in the sessionStorage as well. I've used a similar data flow architecture in my recent open-source app, but with localStorage instead of session.
Yeah, I can do this thing with the help of Reducers, Thanks!😊