Skip to content

Commit

Permalink
#45 add sync-point updater for convenience
Browse files Browse the repository at this point in the history
useful to update the name, too!
  • Loading branch information
minecrawler committed Jun 12, 2022
1 parent 8a35a9f commit 2839b08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/world-builder/world-builder.spec.ts
Expand Up @@ -15,6 +15,12 @@ export interface IWorldBuilder {
*/
build(): IWorld

/**
* Transform the root sync point
* @param updater
*/
updateRootSyncPoint(updater: (root: ISyncPoint) => void): IWorldBuilder

/**
* Register a component in the world
* @param Component
Expand Down
5 changes: 5 additions & 0 deletions src/world-builder/world-builder.ts
Expand Up @@ -74,6 +74,11 @@ export class WorldBuilder implements IWorldBuilder {
}
}

updateRootSyncPoint(updater: (root: ISyncPoint) => void): WorldBuilder {
updater(this.defaultScheduler.pipeline.root);
return this;
}

withComponent(Component: TObjectProto, options?: IComponentRegistrationOptions): WorldBuilder {
this.serde.registerTypeHandler(
Component,
Expand Down

0 comments on commit 2839b08

Please sign in to comment.