Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support promises #129

Open
MathieuDerelle opened this issue Jul 14, 2017 · 3 comments
Open

support promises #129

MathieuDerelle opened this issue Jul 14, 2017 · 3 comments
Assignees
Milestone

Comments

@MathieuDerelle
Copy link

every function could return a Promise if no callback are passed :

const promise = bot.getCategories('foo')

@macbre macbre added this to the Roadmap milestone Jul 14, 2017
@ayoze
Copy link

ayoze commented Aug 24, 2017

@MathieuDerelle you can use bluebird's promisifyAll, I am using it and works like a charm, for example:

var clientEs = new bot({
  protocol: 'https',           // Wikipedia now enforces HTTPS
  server: lang + '.wikipedia.org',  // host name of MediaWiki-powered site
  path: '/w',                  // path to api.php script
  debug: false                 // is more verbose when set to true

});



Promise.promisifyAll( clientEs );

clientEs.getPagesInCategoryAsync(category)
.then(function(data) {

	console.log(JSON.stringify(data.map(function(el) {
		return el.title;
	})));

});

@macbre macbre modified the milestones: Roadmap, v0.12 Aug 25, 2017
@macbre macbre modified the milestones: v0.12, v0.13 Nov 17, 2017
@macbre macbre modified the milestones: v0.13, v0.14 Apr 12, 2020
@KilianKilmister
Copy link

I'm on it

@macbre
Copy link
Owner

macbre commented Jun 25, 2020

@KilianKilmister, welcome on board :) Looking forward to your commits.

@macbre macbre modified the milestones: v0.14, v0.15 Jan 22, 2021
@macbre macbre modified the milestones: v0.15, v1.0 Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants