Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Proposal: window service #828

Closed
Closed
@Toxicable

Description

@Toxicable

TLDR: A pluggable service that provides a consistent pattern for providing services that usually exist on window across platforms that are Universal compatible.

API

interface WindowService {
  localStorage: Storage;
  sessionStorage: Storage;
  caches: CacheStorage;
  ...//other relevant apis
}

//modules
BrowserWindowServiceModule
ServerNoopWindowServiceModule

We'll provide a module that provides services that noop out the api's such as localstorage since it doesn't make any sense for that to work on the server, but in a way that it will be Universal compatible.

Pluggable

You can provide your own implementations for the services found inside the WindowService like so

{
  provide: LOCAL_STORAGE_BACKEND,
  useFactory: myServerLocalStorageBackendFactory
}

draft imp here https://github.com/Toxicable/universal/blob/local-storage/modules/common/src/local-storage/local-storage.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions