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

PC Engine diff consumer #1038

Open
crcn opened this issue Jan 19, 2022 · 2 comments
Open

PC Engine diff consumer #1038

crcn opened this issue Jan 19, 2022 · 2 comments

Comments

@crcn
Copy link
Collaborator

crcn commented Jan 19, 2022

Currently, the engine delegate is doing all of the work around collecting related information about PC content, including all imported style sheets (even of dependencies). This is expensive, not to mention this information is also emitted over RPC.

To reduce some of the cost of this, it makes sense to have a consumer of emitted PC event data that can be used to aggregate this information for things like renderers. For example:

const delegate = createEngineDelegate();

// ... somewhere var events is wired up ...

const consumer = createEngineEventConsumer(events);


const frames = renderFrames(consumer.getContent("file.pc"));

for (const frame of frames) {
  document.body.appendChild(frame);
}

// Consumer handles all patching of PC content, and emits changes
consumer.onChange((uri, currContent, prevContent, event) => {
   patchFrames(frames, currContent, prevCount);
});

the editor client PC document should ever to a shared consumer that takes these events, then updates its own content when it changes.

Considerations

  • This this affect CRDTs (immediate hunch is no).
@crcn
Copy link
Collaborator Author

crcn commented Jan 19, 2022

Consumer can also be used to remove the importedSheets prop emitted by the engine

@crcn
Copy link
Collaborator Author

crcn commented Jan 19, 2022

Also need to be cognizant about consumers that are added after everything evaluates. Need to have some way of populating that data. One possibility is createEngineEventConsumer({ getAllData }) + feeding that through an adapter that works via RPC or in the same process as the engine delegate.

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

No branches or pull requests

1 participant