Background: you can ask CO2 to return segmented results by setting the results option to "segment". The CO2 instance stores this flag for later.
This changes where that flag is stored. Previously, it was stored as a public property of each model. This was unused by the model and is an unnecessary mutation.
Now, the property is stored on the CO2 instance. I believe this is easier to follow. It should also make it possible to turn the models from stateful classes into stateless objects, simplifying the code (an idea that was discussed years ago).
This new flag is explicitly marked private with the @private JSDoc tag and implicitly marked private by prefixing its name with an underscore; a common JS convention. (I considered using private class fields instead, but browser support is new enough that this seemed risky.)
No user impact is expected from this change.
Background: you can ask
CO2
to return segmented results by setting theresults
option to"segment"
. TheCO2
instance stores this flag for later.This changes where that flag is stored. Previously, it was stored as a public property of each model. This was unused by the model and is an unnecessary mutation.
Now, the property is stored on the
CO2
instance. I believe this is easier to follow. It should also make it possible to turn the models from stateful classes into stateless objects, simplifying the code (an idea that was discussed years ago).This new flag is explicitly marked private with the
@private
JSDoc tag and implicitly marked private by prefixing its name with an underscore; a common JS convention. (I considered using private class fields instead, but browser support is new enough that this seemed risky.)