13

We're finding middle path between co-existence of Angular-1 and Angular-4 web applications by hosting them into separate virtual directories.

The goal is- user should not feel any difference when they navigate across different routes.

We have Angular-1 Application which has HTML-5 workers implemented. So we delegate file upload etc to background process. Web Workers.

New enhancements we wish to do in Angular-4 with hyperlinks connecting old vs new apps.

When control transfers to & from from Angular-1 to Angular-4 app, Is there any workaround that background processes (Web workers), could be shared across two apps?

Abhijeet
  • 13,562
  • 26
  • 94
  • 175
  • https://developer.mozilla.org/en/docs/Web/API/SharedWorker – Kaiido Jun 13 '17 at 07:45
  • If it will work between an AngularJS and an Angular 2/4 app, then it will work between any two apps. Angular 2/4 is not a new version of AngularJS. – Aluan Haddad Nov 05 '17 at 00:32
  • Did you considered using a single hybrid app running both angular and angularjs? from your question seems like you want to upgrade the existing angularjs app into something taht is capable of the Angular features. [here](https://angular.io/guide/upgrade)'s the official migration guide, full of clear explanation about how to do it progressively – FrontTheMachine Nov 08 '17 at 12:14

1 Answers1

3

According to the documentation

https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers

A shared worker is accessible by multiple scripts — even if they are being accessed by different windows

But in order to this to work, two web application should share the same protocol, host, and port. If there is a way to run the two web apps in this configuration, you will be able to share the same web worker in both apps.

There are ways to run multiple apps on the same port. If you are using expressjs on the server side, this link might help.

How to mount express.js sub-apps?

If you get your Angular-1 app and Angular-4 run in the same port, I think you will be able to share the Angular-1 worker to the Angular-4 app.

Hope this helps.

Harsha Jayamanna
  • 2,148
  • 6
  • 25
  • 43