How can I use Lasily / Dynamicaly Load classes in Dart?

I was considering using Dart for the Framework that I was going to write. One of the problems I discovered was that I couldn’t lazily load my classes or perform an alternative method of loading more code. I want to dynamically load more code when a user views different areas of the site without reloading the page ((ab) using the history API), but from what I could say, I would have to download all the code up. It just wouldn't work, because it would give terrible first load times, and every time I change any code, users will have to re-download all the code for the website.

An example program that does this in javascript is SyntaxHighlighter . It is possible to load brushes only when they are needed.

In dart, you can load the isolate and forward some serialized version forward to perform syntax highlighting, but for my application I need listeners and event handlers, as well as a lot of manipulations with the DOM and CSS, I just can’t write a custom API to do all this with primitive types.

I was wondering if there is a way to do this in Dart, or if there is something in the work that would allow us to implement this technique. (otherwise it will return to JavaScript).

Thanks Kevin

+4
source share
1 answer

As far as I know, there is no way to load the code dynamically on the fly into an already running Dart program (although this can change when a reflection appears in Dart).

You can download another Dart program and then contact it using postMessage , but that is a bit dwarfed. Maybe you should open a mistake. We also have a large Dart code base and can definitely use something like splitting GWT code to speed it up a bit.

+2
source

All Articles