Skip to content

Commit d4d70d9

Browse files
committed
docs: Update README with latest methods
1 parent 5bb0b88 commit d4d70d9

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Diff for: packages/cozy-external-bridge/README.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ This library allows communication between a container app and an app embedded in
66

77
Just add the `useExternalBridge` hook and it will :
88

9-
- expose a `getContacts` method
109
- allow history syncing
10+
- expose a `getContacts` method
11+
- expose a `getFlag` method
1112

1213
```
1314
import { useExternalBridge } from 'cozy-external-bridge/container'
@@ -19,9 +20,16 @@ const App = () => {
1920

2021
## For embedded app
2122

22-
Import `dist/embedded/bundle.js` script. If you are in the appropriate environment, it should add methods to the `window` object :
23+
Import `dist/embedded/bundle.js` script. It exposes method in `window._cozyBridge`.
24+
25+
At first, you have the following methods in `window._cozyBridge` :
26+
27+
- `isInsideCozy: () => boolean` : check if you are inside a Cozy iframe
28+
- `setupBridge: () => boolean` : setup bridge
29+
30+
After setupping bridge, you have the following methods in `window._cozyBridge` :
2331

24-
- window.\_isInsideCozy: () => boolean
25-
- window.\_startHistorySyncing: () => void
26-
- window.\_stopHistorySyncing: () => void
27-
- window.\_getContacts: () => Promise<IoCozyContact>
32+
- `startHistorySyncing: () => void` : start sending history updates to parent window
33+
- `stopHistorySyncing: () => void` : stop sending history updates to parent window
34+
- `getContacts: () => Promise<IOCozyContact>` : get contacts from parent window
35+
- `getFlag: (key: string) => Promise<string | boolean>` : get flags from parent window

0 commit comments

Comments
 (0)