2021-12-09 21:37:01 -05:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright Google LLC All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
|
*/
|
|
|
|
|
|
2021-12-16 02:00:43 -05:00
|
|
|
/// <reference types="chrome"/>
|
|
|
|
|
|
2021-12-09 00:44:17 -05:00
|
|
|
import {ApplicationOperations} from 'ng-devtools';
|
|
|
|
|
import {DirectivePosition, ElementPosition} from 'protocol';
|
2020-02-07 16:09:36 -05:00
|
|
|
|
|
|
|
|
export class ChromeApplicationOperations extends ApplicationOperations {
|
2024-02-27 09:12:53 -08:00
|
|
|
override viewSource(position: ElementPosition, directiveIndex: number): void {
|
|
|
|
|
if (chrome.devtools) {
|
|
|
|
|
chrome.devtools.inspectedWindow.eval(
|
|
|
|
|
`inspect(inspectedApplication.findConstructorByPosition('${position}', ${directiveIndex}))`,
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-02-07 16:09:36 -05:00
|
|
|
}
|
2020-02-07 22:56:11 -05:00
|
|
|
|
2024-02-27 09:12:53 -08:00
|
|
|
override selectDomElement(position: ElementPosition): void {
|
|
|
|
|
if (chrome.devtools) {
|
|
|
|
|
chrome.devtools.inspectedWindow.eval(
|
|
|
|
|
`inspect(inspectedApplication.findDomElementByPosition('${position}'))`,
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-02-07 22:56:11 -05:00
|
|
|
}
|
2020-04-06 18:02:51 -04:00
|
|
|
|
2024-02-27 09:12:53 -08:00
|
|
|
override inspect(directivePosition: DirectivePosition, objectPath: string[]): void {
|
|
|
|
|
if (chrome.devtools) {
|
|
|
|
|
const args = {
|
|
|
|
|
directivePosition,
|
|
|
|
|
objectPath,
|
|
|
|
|
};
|
|
|
|
|
chrome.devtools.inspectedWindow.eval(
|
|
|
|
|
`inspect(inspectedApplication.findPropertyByPosition('${JSON.stringify(args)}'))`,
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-04-06 18:02:51 -04:00
|
|
|
}
|
2020-02-07 16:09:36 -05:00
|
|
|
}
|