Skip to content

Refactoring: Cleanup dependencies around envControlDataService #141

@klues

Description

@klues

With commit 1ce80fa I implemented a callback system in order to be able to:

  1. automatically get data (also on updates) from envControlDataService to module hardwareIrTrans
  2. be able to update data from hardwareIrTrans to envControlDataService which eventually saves the data to file via ARE.

So in the end a two-way communication between envControlDataService and hardwareIrTrans is needed.
However it is not possible to just include the modules with angularJS dependency injection because it will result in a circular dependency circle, which leads to an angularJS error.

The current implementation is not the prettiest and in the end the architecture should be refactored in this way:

  • there is one dataService which is responsible only for storing data to ARE and notify other modules about updated data.
  • retrieving and saving data to this service will be done with public service methods
  • notifications about changes of the saved data will be done by a subscriber system. So all modules that want to be updated about data updates have to register to updates with a callback. Maybe the observer pattern would fit for this purpose: https://en.wikipedia.org/wiki/Observer_pattern

Currently the dependencies look about like this:
dsc00031

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions