Comparing version 1.4.0 to 1.4.1
@@ -29,3 +29,4 @@ 'use strict'; | ||
all_error_count += error_count; | ||
if (++test_done < all_tests) { | ||
++test_done; | ||
if (test_done < all_tests) { | ||
return; | ||
@@ -32,0 +33,0 @@ } |
{ | ||
"name": "wikiapi", | ||
"title": "JavaScript MediaWiki API for node.js", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Simple way to access MediaWiki API via JavaScript with simple wikitext parser.", | ||
@@ -6,0 +6,0 @@ "keywords": [ "MediaWiki", "MediaWiki API", "wikitext", "ECMAScript 2017" ], |
@@ -180,10 +180,25 @@ 'use strict'; | ||
// Warning: Won't throw if title isn't existed! | ||
function wikiapi_list(type, title, options) { | ||
function wikiapi_list(list_type, title, options) { | ||
function wikiapi_list_executor(resolve, reject) { | ||
const wiki = this[KEY_wiki]; | ||
// 應使用循環取得資料版: | ||
CeL.wiki.list(title, function (list/* , target, options */) { | ||
//console.trace(list); | ||
if (list.error) { | ||
reject(list.error); | ||
} else { | ||
resolve(list); | ||
} | ||
}, Object.assign({ | ||
// [KEY_SESSION] | ||
session: wiki, | ||
type: list_type | ||
}, options)); | ||
/** <code> | ||
// method 2: 使用循環取得資料版: | ||
wiki.cache({ | ||
// Do not write cache file to disk. | ||
cache: false, | ||
type: type, | ||
type: list_type, | ||
list: title | ||
@@ -201,4 +216,4 @@ }, function (list, error) { | ||
/** NG: 不應使用單次版 <code> | ||
wiki[type](title, function callback(list, error) { | ||
// NG: 不應使用單次版 | ||
wiki[list_type](title, function callback(list, error) { | ||
if (error) { | ||
@@ -212,2 +227,3 @@ reject(error); | ||
}, options)); | ||
</code> */ | ||
@@ -236,3 +252,3 @@ } | ||
return wikiapi_list.call(this, type, title, Object.assign({ | ||
for_each: for_each | ||
for_each | ||
}, options)); | ||
@@ -239,0 +255,0 @@ }; |
22655
479