nbrugger-tgm / reactj

A reactive ui lib for easy MVC
LaTeX Project Public License v1.3c
10 stars 0 forks source link

[Refactoring] Add Observer abstraction #37

Closed nbrugger-tgm closed 3 years ago

nbrugger-tgm commented 3 years ago

Observer abstraction

At the moment lists are handled by the Observer class using a workaround. But this Workaround changed the logic of the "normal" property observing logic. Also the structure is not expandable.

Therefore a structure should be created that there is a super-type for Observers and multiple observer implementations can exist

Example structure

AbstractObserver (interface)
├─ ActionObserver (abstract)
│  ├─ MapObserver
│  ├─ ListObserver
├─ ObjectObserver

As this is a fundamental change many systems such as ReactiveController will be affected.

nbrugger-tgm commented 3 years ago

Changes implemented

The changes are implemented.

Additions

The Proxy system had to be reworked too as the systems were tightly bound.

New Proxy Structure:

ProxyEngine (abstract)
|- ReactiveProxyEngine
|- ListProxyEngine

New/Changed therms and classes

Therm Description Usage for Users Final form
ProxyEngine The class to base ProxyEngines off.
Catches proxy calls and distributes them
ReactiveProxyEngine A ProxyEngine for ReactiveProxies
Proxy A class that forwards calls to an ProxyEngine NOT A CLASS
ProxyCreator A ProxyFactory
ReactiveProxy A Proxy that makes an object reactive
ReactiveWrapper Warps a plain object to provide a Reactable implementation.

Warning: Does not calls react automatically!
Thats what ReactiveProxies and ReactiveSubject are used for