Skip to content

Commit

Permalink
docs: readme
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Jun 18, 2020
1 parent 113adb0 commit ed7cf77
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
# chobitsu

[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![License][license-image]][npm-url]

[npm-image]: https://img.shields.io/npm/v/chobitsu.svg
[npm-url]: https://npmjs.org/package/chobitsu
[travis-image]: https://img.shields.io/travis/liriliri/chobitsu.svg
[travis-url]: https://travis-ci.org/liriliri/chobitsu
[license-image]: https://img.shields.io/npm/l/chobitsu.svg

Chrome devtools protocol JavaScript implementation.

## Install

You can get it on npm.

```bash
npm install chobitsu -g
```

## Usage

```javascript
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'
}));
})();
```
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Chobitsu {
setOnMessage(onMessage: OnMessage) {
this.onMessage = onMessage;
}
sendMessage(method: string, params: any) {
sendMessage(method: string, params: any = {}) {
const id = uuid();

this.sendRawMessage(
Expand Down

0 comments on commit ed7cf77

Please sign in to comment.