FHIR / fhir.js

JavaScript client for FHIR
427 stars 136 forks source link

callback vs. promise syntax for generic (pre-adapter) query? #4

Closed jmandel closed 10 years ago

jmandel commented 10 years ago

Current README suggests something promise-like, i.e.

fhir.search('Patient', queryObject)
.then(function(bundle){...})

Should we rely on (or provide a base implementation of) promises, and then wrap those as (jquery/ng/whatever) framework-specific promises in adapters?

Or should we just provide a totally generic callback API in the base package, like

fhir.search('Patient', queryObject, onSuccess, onError);

I'm okay either way, but want to raise the question.

niquola commented 10 years ago

Looks like promises are idiomatic, but has many implementations.

If suggest that end user will use concrete library/framework api, internal fhir implementation could be generic - fhir.search('Patient', queryObject, onSuccess, onError).

As i know js community are trying to create specification

Too much details/questions, i personally like generic api and wrap them in promises on adapters :)

jmandel commented 10 years ago

Good. Callbacks it is.