Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Render service #55

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Render service #55

wants to merge 4 commits into from

Conversation

jteplitz
Copy link
Contributor

Review #51 first.

This is a POC of a RenderService (angular/angular#2409). It uses monkey patching to serialize arguments to RenderService functions at runtime and run the function on the render thread and pass the result (if any) back to the app thread automatically. There are a few issues with this implementation that will need to be addressed for any RenderService implementation that makes its way into angular:

  1. At the moment you need to explicitly tell the RenderService decorator the argument types of your methods as well as the return type. This should be easy to replace with the TypeScript language services
  2. There's still no way to provide custom serializers This should also be fairly easy to add to the angular serializer, but we need to design an API for it.
  3. There is an ordering issue with OnDestroy that prevents it from being used with a RenderService. The worker ElementRef class has been cleared before the ngOnDestroy hook gets fired so the argument can't be serialized.
  4. The MessageBroker does not support Observables. At the moment it only supports Promise or void return types. We need to fix this in order to support event streams from the UI. This also should not be too difficult but will require a breaking change to the MessageBroker (since the broker assumes right now that if you provide a return type it should unwrap a Promise). We should also consider supporting callbacks, but this has some issues with cleanup.
  5. There should be an easy way to initialize RenderServices on the render thread. For this POC you need to explicitly acquire the injector and inject the render service and call ngStartListening (an example of this is in main_ui of this PR. There should probably be a more straightforward API for this.

Once we create a RenderService implementation that addresses all of these issues we can use it to replace the WebWorker Renderer implementation and the angularfire auth implementation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants