Skip to content

Commit 0ffc1d1

Browse files
committed
update-readme
1 parent ce30d05 commit 0ffc1d1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ npm install global-input-react
1616
## 📚 Usage
1717
```JavaScript
1818

19-
import {useGlobalInputApp} from 'global-input-react';
19+
import {useGlobalInputApp,ConnectQR} from 'global-input-react';
2020

2121
```
2222
Then, ```useGlobalInputApp()``` function (which is a React hook) can be called with a parameter, defining a mobile user interface. For example, the following code displays a login screen on the user's mobile screen when connected to your application:
@@ -51,7 +51,7 @@ The ```initData``` contains a ```form``` with a set of fields: ```usernameField`
5151
The object returned by ```useGlobalInputApp()``` function is stored into the ```mobile``` variable. It contains a set of data items and functions for receiving or sending data to the connected mobile app. To begin with, you can place the following code into the rendering part of your code:
5252

5353
```JavaScript
54-
<mobile.ConnectQR/>
54+
<ConnectQR mobile={mobile}/>
5555
```
5656
It displays an encrypted QR Code for mobile apps to scan to connect to your application. It contains the content of ```mobile.connectionCode```, which holds an encrypted string value. When decrypted, it provides information on how to connect to your application, including a one-time-use encryption key for initiating an end-to-end encryption process between your application and a mobile app.
5757

@@ -118,7 +118,7 @@ const login = (username,password) => {
118118
Another way is to place another instance of ```useGlobalInputApp``` in a React component, then render the component when you need to replace mobile user interface.
119119
120120
121-
When ```useGlobalInputApp``` is invoked for the first time, the module will start to initialize itself. In this phase, ```mobile.isLoading``` is set to true, and ```<mobile.ConnectQR/>``` displays a loading symbol. After the initialization is completed, if the application is ready to accept connection, ```mobile.isReady``` is set to true, and ```<mobile.ConnectQR/>``` displays an encrypted QR Code. When a mobile app has connected to your application, ```mobile.isConnected``` is set to true, and ```<mobile.ConnectQR/>``` displays nothing. Those variables are useful if you would like to control what to display during different phases:
121+
When ```mobile=useGlobalInputApp(...)``` is invoked for the first time, the module will start to initialize itself. In this phase, ```mobile.isLoading``` is set to true, and ```<ConnectQR mobile={mobile}/>``` displays a loading symbol. After the initialization is completed, if the application is ready to accept connection, ```mobile.isReady``` is set to true, and ```<ConnectQR mobile={mobile}/>``` displays an encrypted QR Code. When a mobile app has connected to your application, ```mobile.isConnected``` is set to true, and ```<ConnectQR mobile={mobile}/>``` displays nothing. Those variables are useful if you would like to control what to display during different phases:
122122
```JavaScript
123123
{mobile.isConnected && (<>
124124
<h1>Mobile Connected</h1>

0 commit comments

Comments
 (0)