Skip to content

Commit 0f69685

Browse files
author
Justice Ogbonna
committed
Fix issue with removal shim for global
see angular/angular-cli#8160 (comment)
1 parent 4cd5682 commit 0f69685

File tree

3 files changed

+123
-12
lines changed

3 files changed

+123
-12
lines changed

package-lock.json

Lines changed: 115 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/services/socket.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { Injectable } from "@angular/core";
22
import { Observable, Subject, interval, timer } from "rxjs";
33
import { map, takeUntil } from "rxjs/operators";
4+
import io from "socket.io-client";
45

56
import { CacheService } from "./cache.service";
67
import { Event } from "../../common/events";
78

89
@Injectable()
910
export class SocketService {
10-
private socket: SocketIO.Socket;
11+
private socket: SocketIO.Socket = io();
1112
private isAuthedSubj = new Subject<boolean>();
1213
private tokenSubj = new Subject<string>();
1314
private pairedSubj = new Subject<string>();
@@ -18,7 +19,8 @@ export class SocketService {
1819
// No need to watch localStorage, before/after setting this item call the subjects.
1920
// downside is that other tabs may not receive it, which is better to prevent cross tab pollution.
2021
this.isAuthedSubj.next(token != null);
21-
this.socket.addListener(Event.TOKEN, args => {
22+
23+
this.socket.on(Event.TOKEN, args => {
2224
this.tokenSubj.next(args);
2325
});
2426
}

src/polyfills.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,23 @@
4040
/** IE10 and IE11 requires the following for the Reflect API. */
4141
// import 'core-js/es6/reflect';
4242

43-
4443
/** Evergreen browsers require these. **/
4544
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
46-
import 'core-js/es7/reflect';
47-
45+
import "core-js/es7/reflect";
4846

4947
/**
5048
* Required to support Web Animations `@angular/platform-browser/animations`.
5149
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
5250
**/
5351
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
5452

55-
56-
5753
/***************************************************************************************************
5854
* Zone JS is required by default for Angular itself.
5955
*/
60-
import 'zone.js/dist/zone'; // Included with Angular CLI.
61-
62-
56+
import "zone.js/dist/zone"; // Included with Angular CLI.
6357

6458
/***************************************************************************************************
6559
* APPLICATION IMPORTS
6660
*/
61+
// Add global to window, assigning the value of window itself.
62+
(window as any).global = window;

0 commit comments

Comments
 (0)