Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular-1 and Angular-4 Co-Existence in different Apps

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?

like image 341
Abhijeet Avatar asked Jun 13 '17 07:06

Abhijeet


1 Answers

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.

like image 191
Harsha Jayamanna Avatar answered Sep 27 '22 21:09

Harsha Jayamanna