[Diary] local-storage lifecycle
Opened this issue · 1 comments
Data Source Transformation pipeline is applicable for all DS including local-storage
which is selected as simplest demo case. There is no intermediate states and data available immediately.
initialization
Data Source would become a Data Request ( DR ) once template materialized as a part of DOM.
On the constructor execution time it is serving as a DS in the template DOM, hence there is no context to populate the own data slice
. The actual data would be needed once the DS become DR in the context of template rendering DOM. From DR prospective it is a load
event emitted by transformation owner.
Among HTMLElementEventMap
events the Window/load_event looks most promising for DCE to fire down to its children to ignite the data load cycle.
slice
propagation.
The complete transformation step should work against immutable data set. Since the DataRequest and DataTransformer(DT - link TBD) are multi-stage processes and deliver a slice
per state change, it is a transformation owner responsibility to keep the slice
available for the next transformation cycle and not to change the data during transformation.
DR/DT notifies its context by emitting loadend
with own reference and slice content which would be used in following transformation cycle.
Runtime slice
change
For DR asynchronous process the event could be fired at any time including when transformation is completed. The context would update the slice
content and re-trigger the transformation.
notification of final DR state
There are Data Sources which would go over multiple state changes before the full data set is available.
XHR has given a sample of events matching HTTP request life cycle:
- loadstart when connection established and response headers available
- progress with intermediate data
- loadend with final data set
- error
Those events would be used when deciding to replace or discard the slice
data and mark the transformation process as completed.