Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload Method? #134

Open
jcmoore0 opened this issue Mar 2, 2017 · 3 comments
Open

Reload Method? #134

jcmoore0 opened this issue Mar 2, 2017 · 3 comments

Comments

@jcmoore0
Copy link

jcmoore0 commented Mar 2, 2017

Hi Alexis - I am trying to use the new version on an Angular2 project. I am not sure how to use it. The new version looks to be using a different reload mechanism than previously (below).
Do you have any sample?
Thanks for your incredible work here!
Best regards,
John

let HotReloader: any = <any>window[<any>'hr'];
HotReloader && HotReloader.on('change', (fileName: string) => {
    if (fileName.indexOf('html') !== -1) {
        var newBody = document.createElement('body')
        newBody.appendChild(document.createElement('sparq-app'))
        document.body = newBody;
        platformBrowserDynamic().bootstrapModule(AppModule);
    }
});
@alexisvincent
Copy link
Owner

Hi @jcmoore0.

Yeah, the eventing model has been stripped away (I'm planning on replacing it with an Rx Observable). I'm guessing here you're wanting to to save yourself a page reload?

@jcmoore0
Copy link
Author

jcmoore0 commented Mar 2, 2017

Thanks for the quick reply. Your observable plan sounds terrific.

You got it. I am wanting to save some reload time :)

Hot reload goals:

  1. html on html change detected (html is outside js before production bundling)
  2. module/component reload on js file change detected
  3. module recompile reload on ts file change detected

I was doing #1 with the previous version.
I am looking for a sample to make at #1 work with the new version and eventually do 2 and 3.
Best regards,
John

@alexisvincent
Copy link
Owner

If I understand you correctly, then you should have 2 and 3 out of the box. 1 is trickier at the moment since theres no eventing api yet. Are you just saving yourself the full page refresh? Because that shouldn't be happening that often.

If you can give me an example repository I might be able to help you better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants