Skip to content
This repository was archived by the owner on Nov 18, 2021. It is now read-only.

Commit 85e34c0

Browse files
committed
组织文档并发布至 npm
1 parent f3c9ae2 commit 85e34c0

File tree

3 files changed

+23
-26
lines changed

3 files changed

+23
-26
lines changed

.eslintrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
"amd": true,
1010
"jasmine": true
1111
},
12-
"plugins": [
13-
"html"
14-
],
1512
"extends": [
1613
"standard"
1714
]

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# chrome call
22

3-
[![Build Status](https://img.shields.io/travis/lmk123/chrome-call/master.svg?style=flat-square)](https://travis-ci.org/lmk123/chrome-call)
4-
[![Coverage Status](https://img.shields.io/coveralls/lmk123/chrome-call/master.svg?style=flat-square)](https://coveralls.io/github/lmk123/chrome-call?branch=master)
5-
[![dependencies Status](https://img.shields.io/david/lmk123/chrome-call.svg?style=flat-square)](https://david-dm.org/lmk123/chrome-call)
6-
[![devDependencies Status](https://img.shields.io/david/dev/lmk123/chrome-call.svg?style=flat-square)](https://david-dm.org/lmk123/chrome-call#info=devDependencies)
3+
[![Build Status](https://img.shields.io/travis/Selection-Translator/chrome-call/master.svg?style=flat-square)](https://travis-ci.org/Selection-Translator/chrome-call)
4+
[![Coverage Status](https://img.shields.io/coveralls/Selection-Translator/chrome-call/master.svg?style=flat-square)](https://coveralls.io/github/Selection-Translator/chrome-call?branch=master)
5+
[![dependencies Status](https://img.shields.io/david/Selection-Translator/chrome-call.svg?style=flat-square)](https://david-dm.org/Selection-Translator/chrome-call)
6+
[![devDependencies Status](https://img.shields.io/david/dev/Selection-Translator/chrome-call.svg?style=flat-square)](https://david-dm.org/Selection-Translator/chrome-call#info=devDependencies)
77
[![NPM Version](https://img.shields.io/npm/v/chrome-call.svg?style=flat-square)](https://www.npmjs.com/package/chrome-call)
88

99
A really simple way to call the original chrome javascript API and return a Promise.
@@ -19,21 +19,21 @@ npm i -S chrome-call
1919
When you do:
2020

2121
```js
22-
var promise = new Promise(function(resolve,reject) {
23-
chrome.storage.local.get('key',function(items) {
22+
var promise = new Promise(function (resolve, reject) {
23+
chrome.storage.local.get('key', function (items) {
2424
if(chrome.runtime.lastError){
25-
reject(chrome.runtime.lastError);
26-
}else{
27-
resolve(items);
25+
reject(chrome.runtime.lastError)
26+
} else {
27+
resolve(items)
2828
}
29-
});
30-
});
29+
})
30+
})
3131
```
3232

3333
It's equal to:
3434

3535
```js
36-
var promise = chromeCall('storage.local.get','key');
36+
var promise = chromeCall('storage.local.get', 'key')
3737
```
3838

3939
That's really simple, right?
@@ -42,24 +42,24 @@ That's really simple, right?
4242

4343
Most of chrome API only has zero or one argument in callback, but someone not, such as [chrome.hid.receive](https://developer.chrome.com/apps/hid#method-receive).
4444

45-
In this situation, pass `true` as the first argument, then the value of promise will be an (real) Array:
45+
In this situation, pass `true` as the first argument, then the value of promise will be an __real__ Array:
4646

4747
```js
48-
chromeCall(true,'hid.receive',connectionId)
49-
.then(function(args){
50-
Array.isArray(args); // true
51-
var reportId = args[0];
52-
var data = args[1];
53-
});
48+
chromeCall(true, 'hid.receive', connectionId)
49+
.then(function (args) {
50+
Array.isArray(args) // true
51+
var reportId = args[0]
52+
var data = args[1]
53+
})
5454
```
5555

5656
### Scope
5757

5858
The global `chromeCall` search function on `window.chrome`, but you can use different scope:
5959

6060
```js
61-
var local = chromeCall.scope('storage.local'); // or chromeCall.scope(chrome.storage.local)
62-
var promise = local('get','key');
61+
var local = chromeCall.scope('storage.local') // or chromeCall.scope(chrome.storage.local)
62+
var promise = local('get', 'key')
6363
```
6464

6565
## License

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chrome-call",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "A really simple way to call the original chrome javascript API and return a Promise.",
55
"main": "./chrome-call.js",
66
"repository": {
@@ -12,7 +12,7 @@
1212
},
1313
"scripts": {
1414
"test": "karma start",
15-
"lint": "eslint --ignore-pattern '/dist/' \"**/*.{js,vue}\""
15+
"lint": "eslint --ignore-pattern '/coverage/' \"**/*.js\""
1616
},
1717
"devDependencies": {
1818
"es6-promise": "4.0.5",

0 commit comments

Comments
 (0)