Commit 84869dc2 authored by Tim Judkins's avatar Tim Judkins Committed by Commit Bot

[Extensions] Enable promise support on the storage API

This CL changes over the json schema to use the new returns_async format
to define callbacks, enabling promise support on those APIs.

Bug: 328932
Change-Id: I6b93bf1977582ff5a104820728ad891bd2a329e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2514965Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Tim Judkins <tjudkins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826845}
parent bb858b6d
......@@ -51,21 +51,20 @@
],
"description": "A single key to get, list of keys to get, or a dictionary specifying default values (see description of the object). An empty list or object will return an empty result object. Pass in <code>null</code> to get the entire contents of storage.",
"optional": true
},
{
"name": "callback",
"type": "function",
"description": "Callback with storage items, or on failure (in which case $(ref:runtime.lastError) will be set).",
"parameters": [
{
"name": "items",
"type": "object",
"additionalProperties": { "type": "any" },
"description": "Object with items in their key-value mappings."
}
]
}
]
],
"returns_async": {
"name": "callback",
"description": "Callback with storage items, or on failure (in which case $(ref:runtime.lastError) will be set).",
"parameters": [
{
"name": "items",
"type": "object",
"additionalProperties": { "type": "any" },
"description": "Object with items in their key-value mappings."
}
]
}
},
{
"name": "getBytesInUse",
......@@ -80,20 +79,19 @@
],
"description": "A single key or list of keys to get the total usage for. An empty list will return 0. Pass in <code>null</code> to get the total usage of all of storage.",
"optional": true
},
{
"name": "callback",
"type": "function",
"description": "Callback with the amount of space being used by storage, or on failure (in which case $(ref:runtime.lastError) will be set).",
"parameters": [
{
"name": "bytesInUse",
"type": "integer",
"description": "Amount of space being used in storage, in bytes."
}
]
}
]
],
"returns_async": {
"name": "callback",
"description": "Callback with the amount of space being used by storage, or on failure (in which case $(ref:runtime.lastError) will be set).",
"parameters": [
{
"name": "bytesInUse",
"type": "integer",
"description": "Amount of space being used in storage, in bytes."
}
]
}
},
{
"name": "set",
......@@ -106,15 +104,14 @@
"additionalProperties": { "type": "any", "preserveNull": true },
"preserveNull": true,
"description": "<p>An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected.</p><p>Primitive values such as numbers will serialize as expected. Values with a <code>typeof</code> <code>\"object\"</code> and <code>\"function\"</code> will typically serialize to <code>{}</code>, with the exception of <code>Array</code> (serializes as expected), <code>Date</code>, and <code>Regex</code> (serialize using their <code>String</code> representation).</p>"
},
{
"name": "callback",
"type": "function",
"description": "Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set).",
"parameters": [],
"optional": true
}
]
],
"returns_async": {
"name": "callback",
"description": "Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set).",
"parameters": [],
"optional": true
}
},
{
"name": "remove",
......@@ -128,29 +125,26 @@
{"type": "array", "items": {"type": "string"}}
],
"description": "A single key or a list of keys for items to remove."
},
{
"name": "callback",
"type": "function",
"description": "Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set).",
"parameters": [],
"optional": true
}
]
],
"returns_async": {
"name": "callback",
"description": "Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set).",
"parameters": [],
"optional": true
}
},
{
"name": "clear",
"type": "function",
"description": "Removes all items from storage.",
"parameters": [
{
"name": "callback",
"type": "function",
"description": "Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set).",
"parameters": [],
"optional": true
}
]
"parameters": [],
"returns_async": {
"name": "callback",
"description": "Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set).",
"parameters": [],
"optional": true
}
}
],
"events": [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment