@@ -6,8 +6,9 @@ This library allows communication between a container app and an app embedded in
6
6
7
7
Just add the ` useExternalBridge ` hook and it will :
8
8
9
- - expose a ` getContacts ` method
10
9
- allow history syncing
10
+ - expose a ` getContacts ` method
11
+ - expose a ` getFlag ` method
11
12
12
13
```
13
14
import { useExternalBridge } from 'cozy-external-bridge/container'
@@ -19,9 +20,16 @@ const App = () => {
19
20
20
21
## For embedded app
21
22
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 ` :
23
31
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