Lelelo1 / rns-reactify

0 stars 0 forks source link

Handle visibility modifiers gracefully #5

Closed Lelelo1 closed 5 years ago

Lelelo1 commented 5 years ago

Handle visibility modifiers gracefully.

For instance Observable and Frame both use the updateListeners method. It is protected so it should not be visible to the end user.

Lelelo1 commented 5 years ago

Anything accessing private protected fields/methods has to have i'ts implementation directly inside - otherwise this context is lost.

Lelelo1 commented 5 years ago

They can be set and get with reflection.

For example...

protected myVar field declared on Reactify class body:

Screenshot 2019-10-03 at 13 09 23

... being set from getCurrentRefImpl.ts (or any other implementation file) like so:

Screenshot 2019-10-03 at 13 14 42

Which logs..

CONSOLE LOG file:///app/Reactified/API.ts:31:20: myVar: I was set with reflection


That way things that should be protected like myRef, updateListeners() etc will be protected, thus invisible and inaccessible to the end user