Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chrome-debugging-client

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-debugging-client - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

.travis.yml

2

dist/lib/browser-spawner.js

@@ -54,2 +54,4 @@ "use strict";

"--disable-background-networking",
"--disable-cache",
"--v8-cache-options=none",
"--no-proxy-server",

@@ -56,0 +58,0 @@ "--disable-component-extensions-with-background-pages",

@@ -7,4 +7,4 @@ import { EventNotifier } from "./common";

export interface DebuggingProtocol extends EventNotifier, WebSocketDelegate {
send<R, P>(command: string, params?: P): Promise<R>;
send(command: string, params?: any): Promise<any>;
domains(protocol: Protocol): any;
}

@@ -14,1 +14,49 @@ export default class DebuggingProtocolFactoryImpl implements DebuggingProtocolFactory {

}
export declare namespace Protocol {
interface Version {
major: string;
minor: string;
}
interface Domain {
domain: string;
description?: string;
hidden?: boolean;
commands?: Command[];
events?: Event[];
types?: Type[];
}
interface Command {
name: string;
description?: string;
hidden?: boolean;
parameters?: NamedDescriptor[];
returns?: NamedDescriptor[];
}
interface Event {
name: string;
description?: string;
hidden?: boolean;
deprecated?: boolean;
parameters?: NamedDescriptor[];
}
interface Type extends Descriptor {
id: string;
}
interface NamedDescriptor extends Descriptor {
name: string;
optional?: boolean;
}
interface Descriptor {
description?: string;
hidden?: boolean;
$ref?: string;
type?: string;
enum?: string[];
items?: Descriptor;
properties?: NamedDescriptor[];
}
}
export interface Protocol {
domains: Protocol.Domain[];
version: Protocol.Version;
}

@@ -16,2 +16,9 @@ "use strict";

}
domains(protocol) {
let all = {};
protocol.domains.forEach(domain => {
all[domain.domain] = new Domain(this, domain);
});
return all;
}
onMessage(data) {

@@ -64,2 +71,36 @@ try {

}
class Domain {
constructor(client, domain) {
this._client = client;
this._domain = domain;
if (domain.commands) {
domain.commands.forEach(command => {
let prefixed = `${domain.domain}.${command.name}`;
this[command.name] = (params) => {
return this._client.send(prefixed, params);
};
});
}
if (domain.events) {
domain.events.forEach(event => {
let prefixed = `${domain.domain}.${event.name}`;
let listener;
Object.defineProperty(this, event.name, {
get: () => {
return listener;
},
set: (v) => {
if (listener) {
this._client.removeListener(prefixed, listener);
}
listener = v;
if (v) {
this._client.on(prefixed, v);
}
}
});
});
}
}
}
class ProtocolError extends Error {

@@ -66,0 +107,0 @@ constructor(err) {

@@ -10,2 +10,3 @@ export * from "./api-client-factory";

export * from "./tmpdir-creator";
export { default as ProtocolCodegen } from "./protocol-codegen";
export { default as createSession } from "./session";

@@ -14,4 +14,6 @@ "use strict";

__export(require("./tmpdir-creator"));
var protocol_codegen_1 = require("./protocol-codegen");
exports.ProtocolCodegen = protocol_codegen_1.default;
var session_2 = require("./session");
exports.createSession = session_2.default;
//# sourceMappingURL=index.js.map

@@ -55,2 +55,4 @@ import { EventNotifier, Disposable, delay } from "./common";

"--disable-background-networking",
"--disable-cache",
"--v8-cache-options=none",
"--no-proxy-server",

@@ -57,0 +59,0 @@ "--disable-component-extensions-with-background-pages",

@@ -10,4 +10,4 @@ import { EventNotifier } from "./common";

export interface DebuggingProtocol extends EventNotifier, WebSocketDelegate {
send<R, P>(command: string, params?: P): Promise<R>;
send(command: string, params?: any): Promise<any>;
domains(protocol: Protocol): any;
}

@@ -41,2 +41,10 @@

domains(protocol?: Protocol): any {
let all = {};
protocol.domains.forEach(domain => {
all[domain.domain] = new Domain(this, domain);
});
return all;
}
onMessage(data: string) {

@@ -88,2 +96,40 @@ try {

class Domain {
private _client: DebuggingProtocol;
private _domain: Protocol.Domain;
constructor(client: DebuggingProtocol, domain: Protocol.Domain) {
this._client = client;
this._domain = domain;
if (domain.commands) {
domain.commands.forEach(command => {
let prefixed = `${domain.domain}.${command.name}`;
this[command.name] = (params) => {
return this._client.send(prefixed, params);
};
});
}
if (domain.events) {
domain.events.forEach(event => {
let prefixed = `${domain.domain}.${event.name}`;
let listener;
Object.defineProperty(this, event.name, {
get: () => {
return listener;
},
set: (v) => {
if (listener) {
this._client.removeListener(prefixed, listener);
}
listener = v;
if (v) {
this._client.on(prefixed, v);
}
}
});
});
}
}
}
interface Event {

@@ -118,1 +164,57 @@ method: string;

}
export namespace Protocol {
export interface Version {
major: string;
minor: string;
}
export interface Domain {
domain: string;
description?: string;
hidden?: boolean;
commands?: Command[];
events?: Event[];
types?: Type[];
}
export interface Command {
name: string;
description?: string;
hidden?: boolean;
parameters?: NamedDescriptor[];
returns?: NamedDescriptor[];
}
export interface Event {
name: string;
description?: string;
hidden?: boolean;
deprecated?: boolean;
parameters?: NamedDescriptor[];
}
export interface Type extends Descriptor {
id: string;
}
export interface NamedDescriptor extends Descriptor {
name: string;
optional?: boolean;
}
export interface Descriptor {
description?: string;
hidden?: boolean;
$ref?: string;
type?: string;
enum?: string[];
items?: Descriptor;
properties?: NamedDescriptor[];
}
}
export interface Protocol {
domains: Protocol.Domain[];
version: Protocol.Version;
}

2

lib/index.ts

@@ -11,3 +11,3 @@ export * from "./api-client-factory";

export { default as ProtocolCodegen } from "./protocol-codegen";
export { default as createSession } from "./session";
{
"name": "chrome-debugging-client",
"version": "0.1.0",
"version": "0.1.1",
"description": "Chrome debugging client",

@@ -5,0 +5,0 @@ "keywords": [

@@ -7,3 +7,3 @@ chrome-debugging-client

```js
import { createSession } from "./index";
import { createSession } from "chrome-debugging-client";

@@ -10,0 +10,0 @@ createSession(async (session) => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc