Skip to content

Commit

Permalink
Merge pull request #66 from yujiosaka/fix_annotation
Browse files Browse the repository at this point in the history
Fix annotation
  • Loading branch information
yujiosaka authored Jan 12, 2018
2 parents 19a7690 + e09f8ed commit 86b3a02
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
6 changes: 6 additions & 0 deletions cache/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
"extends": "../.eslintrc.js",
"rules": {
"no-unused-vars": 0,
},
};
12 changes: 6 additions & 6 deletions cache/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class BaseCache {
* @param {!string} key
* @return {!Promise}
*/
get() {
get(key) {
throw new Error('Get is not overridden!');
}

Expand All @@ -43,7 +43,7 @@ class BaseCache {
* @param {!string} value
* @return {!Promise}
*/
set() {
set(key, value) {
throw new Error('Set is not overridden!');
}

Expand All @@ -53,31 +53,31 @@ class BaseCache {
* @param {!number=} priority
* @return {!Promise}
*/
enqueue() {
enqueue(key, value, priority) {
throw new Error('Enqueue is not overridden!');
}

/**
* @param {!string} key
* @return {!Promise}
*/
dequeue() {
dequeue(key) {
throw new Error('Dequeue is not overridden!');
}

/**
* @param {!string} key
* @return {!Promise<!number>}
*/
size() {
size(key) {
throw new Error('Size is not overridden!');
}

/**
* @param {!string} key
* @return {!Promise}
*/
remove() {
remove(key) {
throw new Error('Remove is not overridden!');
}
}
Expand Down
4 changes: 3 additions & 1 deletion cache/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class SessionCache extends BaseCache {
* @return {!Promise}
* @override
*/
close() {}
close() {
return Promise.resolve();
}

/**
* @param {!string} key
Expand Down
2 changes: 1 addition & 1 deletion lib/async-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class AsyncEventEmitter extends EventEmitter {
/**
* @param {!string} event
* @param {...*} args
* @param {!Promise}
* @return {!Promise}
*/
emit(event, ...args) {
const promises = [];
Expand Down
5 changes: 3 additions & 2 deletions lib/crawler.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const jQueryPath = require.resolve('jquery');

class Crawler {
/**
* @param {!Puppeteer.Page} page
* @param {!puppeteer.Page} page
* @param {!Object} options
*/
constructor(page, options) {
Expand Down Expand Up @@ -80,6 +80,7 @@ class Crawler {
return this._page.evaluateOnNewDocument(() => {
window.open = (url => {
window.location.href = url;
return window;
});
});
}
Expand Down Expand Up @@ -129,7 +130,7 @@ class Crawler {
_handlePageEvents() {
this._page.on('pageerror', msg => void debugConsole(msg));
this._page.on('console', msg => void debugConsole(`${msg.type} ${msg.text} at ${this._options.url}`));
this._page.on('dialog', dialog => this._handleDialog(dialog, this._options));
this._page.on('dialog', dialog => this._handleDialog(dialog));
}

/**
Expand Down
8 changes: 4 additions & 4 deletions lib/hccrawler.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class HCCrawler extends EventEmitter {
}

/**
* @return {!bolean}
* @return {!boolean}
*/
isPaused() {
return this._queue.isPaused();
Expand Down Expand Up @@ -342,7 +342,7 @@ class HCCrawler extends EventEmitter {
}

/**
* @param {!string} robotsUrl
* @param {!string} url
* @return {!Promise<?string>}
* @private
*/
Expand Down Expand Up @@ -423,7 +423,7 @@ class HCCrawler extends EventEmitter {

/**
* @param {!Object} result
* @return {!Promise<?boolean>}
* @return {!Promise}
* @private
*/
_success(result) {
Expand All @@ -433,7 +433,7 @@ class HCCrawler extends EventEmitter {

/**
* @param {!Error} error
* @return {!Promise<?boolean>}
* @return {!Promise}
* @private
*/
_error(error) {
Expand Down
2 changes: 1 addition & 1 deletion lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Helper {
*/
static hash(src) {
const md5hash = crypto.createHash('md5');
md5hash.update(src, 'binary');
md5hash.update(src, 'utf8');
return md5hash.digest('hex');
}

Expand Down

0 comments on commit 86b3a02

Please sign in to comment.