lddubeau / requirejs-reload Goto Github PK
View Code? Open in Web Editor NEWExample for SO question 19966133
Example for SO question 19966133
hey Sr. Louis
I saw your answer on SO here:
http://stackoverflow.com/questions/19966133/how-to-reload-a-file-via-require-js-triggered-from-the-browsers-js-console
I saw a video of some folks doing hot-reloading with React + Webpack. Thought it could possible with RequireJS, at least with views (not stores).
I have a question though. Say I reload all the .js files for a view.
I assume I would have to call .render() again after loading the views (whether react or backbone) so that the html in the view is actually updated, right? If I don't call render(), nothing visible will happen, right?
The nice thing about all this is it avoids refreshing the page and losing state.
It would be really cool if you could describe a detailed step-by-step workflow on how this functionality is intended to be used.
I will make an attempt here and now, please correct me:
(1) make a globally defined (window.reload) function that will take arguments in the form of paths to files
(2) create some mechanism to invoke that function given an event (a button that gets clicked)*
(3) you click that button and the reload function will undef the current files and then request those files from the server and put the new files in the same places as the old files
(4) you will need some further action to actually show the difference between the old and new JS, and think that means you will have to call .render() again
can you please correct this? thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.