Open lifeart opened 3 years ago
Good catch. Need to add guards for FastBoot at all places at which we use either window.addEventListener
or window.localStorage
.
FastBoot documentation for addon author discusses two approaches:
I would prefer the first. Don't want to split the code over multiple places.
Happy to accept a PR.
I just noticed that FastBoot support is not as simple as expected. The decorator uses a global cache for local storage values: https://github.com/jelhan/ember-local-storage-decorator/blob/f80d55e0379a3ea285eb19500e3f2a454fd43bd3/addon/index.js#L3-L4
In FastBoot many application instances may run in parallel. To support FastBoot the caching implementation must be changed to cache the value per application instance.
https://github.com/jelhan/ember-local-storage-decorator/blob/6702fab573f14edf3391443c5bf84e9277e862d3/addon/index.js#L6
as I know, there is no window in fastboot, this logic could be moved to initializer