Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof of concept: publisher-subscriber model for asset loading #96

Closed
wants to merge 5 commits into from

Conversation

mggower
Copy link
Collaborator

@mggower mggower commented Feb 2, 2024

  • large graphs were experiencing errors because too many promises were being emitted simultaneously
  • a publisher-subscriber model for asset loading reduces the amount of async loading is required
  • this approach is non-blocking, so things like text will use default fonts before a font asset is loaded by the browser which speeds up the initial paint

@mggower mggower changed the base branch from master to feature/edge-labels February 2, 2024 16:31
asset: T | null = null
subscribers = new Set<Subscriber<T>>()

protected abstract caller(): Promise<T>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't think of a better name for this method lol

import { Renderer } from '../..'

export default abstract class TextureAbstract {
resolution = 2
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: plug in to Renderer options

@jameslaneconkling
Copy link
Contributor

Let's try the loader pattern I mentioned here and see if that helps. The Async function (which is really just a callback with some bells/whistles to make it feel more like a promise) is more lightweight than a promise, so might not have the same issue.

@mggower mggower closed this Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants