phosphorjs / phosphor

The PhosphorJS Library
BSD 3-Clause "New" or "Revised" License
1.04k stars 166 forks source link

[Question] Hot reloading phosphor widgets? #419

Closed Madhu94 closed 4 years ago

Madhu94 commented 4 years ago

Is it possible to do this currently ?

If it hasn't been done because no one got to it, or if we don't know if this is even possible, I'd like to explore this space.

Something makes me feel it may not be feasible since phosphor is very different from other virtual dom based UI libraries like React and Vue, but I also don't know much about how HMR works to comment on that.

sccolbert commented 4 years ago

Can you describe more of what you mean, perhaps with a hypothetical example use case?

Madhu94 commented 4 years ago

There's really no use case other than a slight boost to developer productivity. I wondered if something like https://github.com/gaearon/react-hot-loader existed for developing with @phosphor/widgets - where editing a widget reloads its code in the browser, without having to refresh the page.

sccolbert commented 4 years ago

I think that would be hard to do, for the same reason you shouldn't load two instances of Phosphor on the page at the same time. It breaks the instanceof operator and some other assumptions made throughout the library. Since you can't remove objects which have already been loaded into the JS engine, this would cause multiple versions of Phosphor to get loaded on the page.

Madhu94 commented 4 years ago

Makes sense. Thanks !