D
D
Destell2019-08-02 12:15:25
JavaScript
Destell, 2019-08-02 12:15:25

How to dynamically get property updates from the new Class() singleton if they happen in the constructor?

There is a singleton class with the isActive property, the value is overwritten in the constructor. How to receive isActive changes outside the class in real time? Using mobx didn't help.

const track = new Class();
console.log(track.isActive)

only the first value is returned and there is no response to subsequent changes.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Destell, 2019-08-02
@Destell

The problem turned out to be incredibly stupid.
It was necessary to fix the export.

const createdClass = new Class();
export createdClass;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question