Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1801)

Unified Diff: docs/explainer.md

Issue 1963823003: Rewrite Share interface docs and split into two APIs. (Closed) Base URL: git@github.com:chromium/ballista.git@master
Patch Set: Rebrand as Web Share (not Ballista). Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | docs/interface_share.md » ('j') | docs/interface_share.md » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: docs/explainer.md
diff --git a/docs/explainer.md b/docs/explainer.md
index 6f0167a50c562614058d3411df4d3568023b7b07..fc013d5b9f3566ff923860ab952f2e1889a49966 100644
--- a/docs/explainer.md
+++ b/docs/explainer.md
@@ -114,8 +114,8 @@ choosing, just attach this JavaScript code to a "share" button.
```js
shareButton.addEventListener('click', () => {
- navigator.actions.performAction('share', {url: window.location.href})
- .then(action => console.log(action));
+ navigator.share({url: window.location.href})
+ .then(console.log('Share successful'));
});
```
@@ -142,24 +142,18 @@ any tabs.
"name": "Includinator",
"short_name": "Includinator",
"icons": [...],
- "actions": [
- {
- "verb": "share"
- }
- ]
+ "supports_share": true
}
```
#### serviceworker.js
```js
-navigator.actions.addEventListener('handle', event => {
- if (event.options.verb == 'share') {
- if (event.data.url === undefined)
- throw new Error('Did not contain URL.');
+navigator.actions.addEventListener('share', event => {
+ if (event.data.url === undefined)
+ throw new Error('Did not contain URL.');
- includinate(event.data.url);
- }
+ includinate(event.data.url);
});
```
« no previous file with comments | « no previous file | docs/interface_share.md » ('j') | docs/interface_share.md » ('J')

Powered by Google App Engine
This is Rietveld 408576698