From 38a5373c55fadeb42e2da11f9eac5f8f7f76cc9e Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Wed, 22 Jan 2020 16:17:39 -0800 Subject: [PATCH] rethink API shape --- index.bs | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/index.bs b/index.bs index 1117935..69068da 100644 --- a/index.bs +++ b/index.bs @@ -2774,8 +2774,7 @@ interface IDBObjectStore { optional [EnforceRange] unsigned long count); [NewObject] IDBRequest getAllKeys(optional any query, optional [EnforceRange] unsigned long count); - [NewObject] IDBRequest getAllEntries(optional any query, - optional [EnforceRange] unsigned long count); + [NewObject] IDBRequest getAllEntries(optional IDBGetAllEntriesOptions options = {}); [NewObject] IDBRequest count(optional any query); [NewObject] IDBRequest openCursor(optional any query, @@ -2795,6 +2794,12 @@ dictionary IDBIndexParameters { boolean unique = false; boolean multiEntry = false; }; + +dictionary IDBGetAllEntriesOptions { + any query = null; + [EnforceRange] unsigned long count; + IDBCursorDirection direction = "next"; +};
@@ -3157,15 +3162,13 @@ must run these steps: be an [=Array=] of the [=/keys=]. : |request| = |store| . - {{IDBObjectStore/getAllEntries()|getAllEntries}}(query [, - |count|]) + {{IDBObjectStore/getAllEntries()|getAllEntries}}(|options|) :: - Retrieves the [=/keys=] and [=/values=] of [=object-store/records=] matching the - given [=/key=] or [=key range=] in |query| (up to |count| if given). + Retrieves multiple [=/keys=] and [=/values=] of [=object-store/records=]. - If successful, |request|'s {{IDBRequest/result}} will - be an [=Array=], with each member being an [=Array=] with a [=/key=] - [=/value=] pair. + The |query| option specifies a [=/key=] or [=key range=] to match. The |count| option limits the number or records matched. Set the |direction| option to {{"next"}} to retrieve the first |count| records, or {{"prev"}} to return the last |count| records. + + If successful, |request|'s {{IDBRequest/result}} will be an [=Array=], with each member being an [=Array=] with a [=/key=] [=/value=] pair. : |request| = |store| . {{IDBObjectStore/count()|count}}(|query|) @@ -3741,8 +3744,7 @@ interface IDBIndex { optional [EnforceRange] unsigned long count); [NewObject] IDBRequest getAllKeys(optional any query, optional [EnforceRange] unsigned long count); - [NewObject] IDBRequest getAllEntries(optional any query, - optional [EnforceRange] unsigned long count); + [NewObject] IDBRequest getAllEntries(optional IDBGetAllEntriesOptions options = {}); [NewObject] IDBRequest count(optional any query); [NewObject] IDBRequest openCursor(optional any query, @@ -3892,8 +3894,7 @@ return **this**'s [=index-handle/index=]'s [=unique flag=]. : |request| = |index| . - {{IDBIndex/getAllEntries()|getAllEntries}}(query [, - |count|]) + {{IDBIndex/getAllEntries()|getAllEntries}}(|query| [, |count|]) :: Retrieves the [=/keys=], [=/values=], and index [=/keys=] of [=object-store/records=] matching the given [=/key=] or [=key range=] in |query| (up to |count| if given).