Skip to content

Chrome devtools protocol JavaScript implementation

License

Notifications You must be signed in to change notification settings

fantasticco/chobitsu

 
 

Repository files navigation

chobitsu

NPM version Build status Test coverage License

Chrome devtools protocol JavaScript implementation.

Install

You can get it on npm.

npm install chobitsu --save

Usage

const chobitsu = require('chobitsu');

chobitsu.setOnMessage(message => {
  console.log(message);
});

chobitsu.sendRawMessage(JSON.stringify({
  id: 1,  
  method: 'DOMStorage.clear',
  params: {
    storageId: {
      isLocalStorage: true,
      securityOrigin: 'http://example.com'
    }
  }
}));

!(async () => {
  console.log(await chobitsu.sendMessage('Storage.clearDataForOrigin', {
    storageTypes: 'local_storage'
  }));
})();

const domStorage = chobitsu.domain('DOMStorage');
domStorage.enable();
domStorage.on('domStorageItemUpdated', params => console.log(params));

API

sendRawMessage(message: string)

Send message to chobitsu.

setOnMessage(onMessage: (message: string) => void)

Set message handler.

sendMessage(method: string, params: any): Promise

Send message without setting id and get result.

domain(name: string)

Get domain object.

Related Projects

  • chii: Remote debugging tool.

About

Chrome devtools protocol JavaScript implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.7%
  • JavaScript 3.3%