Permalink
Browse files

Changed named property handlers to match the new API: http://groups.g…

  • Loading branch information...
1 parent 7479ce0 commit 767c410c16a86df7ca6b8538627bb3ccdbe9cdd8 @liesen committed Oct 13, 2010
Showing with 15 additions and 7 deletions.
  1. +7 −3 src/playlist.cc
  2. +1 −1 src/playlist.h
  3. +6 −2 src/playlistcontainer.cc
  4. +1 −1 src/playlistcontainer.h
View
@@ -189,16 +189,20 @@ Handle<Boolean> Playlist::TrackDeleter(uint32_t index,
return False();
}
-Handle<Boolean> Playlist::TrackQuery(uint32_t index,
+Handle<Integer> Playlist::TrackQuery(uint32_t index,
const AccessorInfo& info) {
HandleScope scope;
Playlist* p = Unwrap<Playlist>(info.This());
if (!p->IsLoaded())
- return False();
+ return Handle<Integer>();
int num_tracks = sp_playlist_num_tracks(p->playlist_);
- return scope.Close(Boolean::New(index < num_tracks));
+
+ if (index >= num_tracks)
+ return Handle<Integer>();
+
+ return scope.Close(Integer::New(None));
}
Handle<Array> Playlist::TrackEnumerator(const AccessorInfo& info) {
View
@@ -32,7 +32,7 @@ class Playlist : public node::EventEmitter {
static v8::Handle<v8::Boolean> TrackDeleter(uint32_t index,
const v8::AccessorInfo& info);
- static v8::Handle<v8::Boolean> TrackQuery(uint32_t index,
+ static v8::Handle<v8::Integer> TrackQuery(uint32_t index,
const v8::AccessorInfo& info);
static v8::Handle<v8::Array> TrackEnumerator(const v8::AccessorInfo& info);
@@ -144,12 +144,16 @@ Handle<Boolean> PlaylistContainer::PlaylistDeleter(uint32_t index,
}
-Handle<Boolean> PlaylistContainer::PlaylistQuery(uint32_t index,
+Handle<Integer> PlaylistContainer::PlaylistQuery(uint32_t index,
const AccessorInfo& info) {
HandleScope scope;
PlaylistContainer* pc = Unwrap<PlaylistContainer>(info.This());
int num_playlists = pc->NumPlaylists();
- return scope.Close(Boolean::New(index < num_playlists));
+
+ if (index < num_playlists)
+ return scope.Close(Integer::New(None));
+
+ return Handle<Integer>();
}
Handle<Array> PlaylistContainer::PlaylistEnumerator(const AccessorInfo& info) {
@@ -24,7 +24,7 @@ class PlaylistContainer : public node::EventEmitter {
const v8::AccessorInfo& info);
static v8::Handle<v8::Boolean> PlaylistDeleter(uint32_t index,
const v8::AccessorInfo& info);
- static v8::Handle<v8::Boolean> PlaylistQuery(uint32_t index,
+ static v8::Handle<v8::Integer> PlaylistQuery(uint32_t index,
const v8::AccessorInfo& info);
static v8::Handle<v8::Array> PlaylistEnumerator(const v8::AccessorInfo& info);

0 comments on commit 767c410

Please sign in to comment.