Tokamak icon indicating copy to clipboard operation
Tokamak copied to clipboard

Allow attaching multiple `App` instances to different DOM nodes

Open MaxDesiatov opened this issue 3 years ago • 0 comments

This is a follow-up to https://github.com/swiftwasm/Tokamak/issues/224. I think we could introduce a new API within the TokamakDOM module (though in theory it could work with any renderer as long as they don't rely on anything singleton-ish in a disruptive way):

extension App {
  func _render(in: JSObjectRef) {
    // ...
  }
}

This would allow attaching multiple App instances in different places of your DOM tree to allow incremental rewrites from other frameworks to Tokamak.

An alternative API for this could be based on custom Scenes, but I'm not sure how exactly that would look.

MaxDesiatov avatar Jul 29 '20 20:07 MaxDesiatov