mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(devtools): proper dev mode detection when app compiled with closure
This commit is contained in:
@@ -21,8 +21,16 @@ export const appIsSupportedAngularVersion = (): boolean => {
|
||||
return appIsAngular() && (major >= 9 || major === 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* We check if the global `window.ng` is an object and if this object
|
||||
* has the `getComponent` method attached to it. In some g3 apps processed
|
||||
* with Closure, `ng` is a function, which means that `typeof ng !== 'undefined'`
|
||||
* is not a sufficient check.
|
||||
*
|
||||
* @returns if the app has global ng debug object
|
||||
*/
|
||||
const appHasGlobalNgDebugObject = (): boolean => {
|
||||
return typeof ng !== 'undefined';
|
||||
return typeof ng === 'object' && typeof ng.getComponent === 'function';
|
||||
};
|
||||
|
||||
export const getAngularVersion = (): string | null => {
|
||||
|
||||
@@ -50,7 +50,7 @@ export const subscribeToClientEvents = (messageBus: MessageBus<Events>): void =>
|
||||
// Often websites have `scroll` event listener which triggers
|
||||
// Angular's change detection. We don't want to constantly send
|
||||
// update requests, instead we want to request an update at most
|
||||
// every 250ms
|
||||
// once every 250ms
|
||||
runOutsideAngular(() => {
|
||||
initializeOrGetDirectiveForestHooks()
|
||||
.profiler.changeDetection$.pipe(debounceTime(250))
|
||||
|
||||
@@ -8,7 +8,12 @@ export const runOutsideAngular = (f: () => any): void => {
|
||||
w.Zone.current.run(f);
|
||||
return;
|
||||
}
|
||||
w.Zone.current._parent.run(f);
|
||||
const parent = w.Zone.current._parent;
|
||||
if (parent && parent.run) {
|
||||
parent.run(f);
|
||||
return;
|
||||
}
|
||||
f();
|
||||
};
|
||||
|
||||
export const isCustomElement = (node: Node) => {
|
||||
|
||||
Reference in New Issue
Block a user