UNPKG

2.29 kBJavaScriptView Raw
1const inspectorCommands = require('./InspectorBackendCommands');
2import * as debuggerDomains from '.';
3import { attachDOMInspectorEventCallbacks, attachDOMInspectorCommandCallbacks } from './devtools-elements';
4let DOMDomainDebugger = class DOMDomainDebugger {
5 constructor() {
6 this.events = new inspectorCommands.DOMDomain.DOMFrontend();
7 this.commands = {};
8 attachDOMInspectorEventCallbacks(this.events);
9 attachDOMInspectorCommandCallbacks(this.commands);
10 // By default start enabled because we can miss the "enable event when
11 // running with `--debug-brk` -- the frontend will send it before we've been created
12 this.enable();
13 }
14 get enabled() {
15 return this._enabled;
16 }
17 enable() {
18 if (debuggerDomains.getDOM()) {
19 throw new Error('One DOMDomainDebugger may be enabled at a time.');
20 }
21 else {
22 debuggerDomains.setDOM(this);
23 }
24 this._enabled = true;
25 }
26 /**
27 * Disables network tracking, prevents network events from being sent to the client.
28 */
29 disable() {
30 if (debuggerDomains.getDOM() === this) {
31 debuggerDomains.setDOM(null);
32 }
33 this._enabled = false;
34 }
35 getDocument() {
36 const domNode = this.commands.getDocument();
37 return { root: domNode };
38 }
39 removeNode(params) {
40 this.commands.removeNode(params.nodeId);
41 }
42 setAttributeValue(params) {
43 throw new Error('Method not implemented.');
44 }
45 setAttributesAsText(params) {
46 this.commands.setAttributeAsText(params.nodeId, params.text, params.name);
47 }
48 removeAttribute(params) {
49 throw new Error('Method not implemented.');
50 }
51 performSearch(params) {
52 return null;
53 }
54 getSearchResults(params) {
55 return null;
56 }
57 discardSearchResults(params) {
58 return;
59 }
60 highlightNode(params) {
61 return;
62 }
63 hideHighlight() {
64 return;
65 }
66 resolveNode(params) {
67 return null;
68 }
69};
70DOMDomainDebugger = __decorate([
71 inspectorCommands.DomainDispatcher('DOM'),
72 __metadata("design:paramtypes", [])
73], DOMDomainDebugger);
74export { DOMDomainDebugger };
75//# sourceMappingURL=webinspector-dom.js.map
\No newline at end of file