Floby / node-libspotify

Node bindings for the libspotify C library
projects.flo.by/node-libspotify/
102 stars 66 forks source link

Make user of this lib only deal with loaded objects? #15

Open Floby opened 11 years ago

Floby commented 11 years ago

This is something I'd like to discuss with people actually using this lib.

I first tried to stick as closely as possible to the C API, just adding some javascript sugar and grouping namespaced C functions to objects.

But it seems to me that the Node Way would tell us to give users only ready objects.

Feel free to comment.

19h commented 11 years ago

We're deploying this primarily for the performance of lookups using the C API compared to the other REST "wrapper" libraries. What exactly is your understanding of "loaded" / "ready" objects?

Floby commented 11 years ago

loaded object's method isReady return true.

On 30 May 2013 12:21, Kenan Sulayman notifications@github.com wrote:

We're deploying this primarily for the performance of lookups using the C API compared to the other REST "wrapper" libraries. What exactly is your understanding of "loaded" objects?

— Reply to this email directly or view it on GitHubhttps://github.com/Floby/node-libspotify/issues/15#issuecomment-18672201 .

ls12styler commented 11 years ago

I'm also having difficulty with what you mean by 'loaded objects'. Use case?

Floby commented 11 years ago

I was thinking of moving all the API to an more classic async style like so

sp.Track.getFromUrl('spotify:track:fdskjhluyqzeljh', function (err, track) {
  if (!err) {
    track.isReady() === true;
  }
})
ls12styler commented 11 years ago

I think that's a good idea. It keeps the whole API inline with Node stuff in general. I'd rather (as a consumer of the module) work in this manner.

LinusU commented 11 years ago

+1 this would be great! I must say that I really like the api used in https://github.com/TooTallNate/node-spotify-web