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

Move to asynchronous input parsing #29

Closed
larsgw opened this issue Mar 11, 2017 · 0 comments
Closed

Move to asynchronous input parsing #29

larsgw opened this issue Mar 11, 2017 · 0 comments
Assignees
Labels
enhancement Feature requests
Projects

Comments

@larsgw
Copy link
Owner

larsgw commented Mar 11, 2017

Parsing input sometimes requires calls to e.g. the Wikidata API, but with the current setup, this has to use synchronous requests, something that should be avoided. I propose the following syntax:

Cite.parseInput(<data>, <optional: callback>)

function callback (result) {
  result // Parsed input (CSL-JSON)
}

Not providing callback (when required) will cause a warning and will probably be deprecated in the next version (so either v0.4 or v1.0). I could add both parseInput and parseInputAsync, to avoid the optional callback and just warning/throwing an error when parseInput is used when requests need to be made.

The following is possible too (perhaps both?):

Cite(<data>, <optional: options>, <optional: callback>)

function callback (result) {
  result // Cite object
}

This, however, has at least all the problems the one above has, and probably more.

@larsgw larsgw added the enhancement Feature requests label Mar 11, 2017
@larsgw larsgw self-assigned this Mar 11, 2017
@larsgw larsgw added this to TODO in Version 0.3 Mar 15, 2017
@larsgw larsgw moved this from TODO to In Progress in Version 0.3 Apr 3, 2017
@larsgw larsgw moved this from In Progress to TODO in Version 0.3 Apr 7, 2017
@larsgw larsgw moved this from TODO to In Progress in Version 0.3 May 8, 2017
@larsgw larsgw closed this as completed in ad7c96b May 15, 2017
@larsgw larsgw moved this from In Progress to Done in Version 0.3 May 15, 2017
@larsgw larsgw mentioned this issue May 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests
Projects
No open projects
Development

No branches or pull requests

1 participant