Skip to content

Commit 2b60640

Browse files
authored
Update README.md
1 parent 680eee9 commit 2b60640

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,22 @@ The required properties `id`, `userId`, `$created`, `$updated`, `$deleted` and `
108108
109109
When the user is authenticated with `login()`, new records will get the `userId` property automatically and all `read`, `list`, `update` and `delete` requests are limited to the users records (see [Multi Tenancy Documentation](https://github.com/mevdschee/php-crud-api#multi-tenancy-support)).
110110
111-
## Function Details
111+
## Class Details
112112
113-
### useSync(endpoint)
113+
### Sync(endpoint)
114114
115115
Intializes the synchronization API.
116116
117117
- `endpoint`: `<string>`, *optional*, [PHP CRUD API](https://github.com/mevdschee/php-crud-api?tab=readme-ov-file#installation) endpoint, internal or external, default `/api.php`
118118
119119
```js
120-
const sync = useSync()
120+
import Sync from 'dexie-mysql-sync'
121+
const sync = new Sync()
121122
```
122123
123-
#### sync.add(table, path, options)
124+
## Function Details
125+
126+
### sync.add(table, path, options)
124127
125128
Starts the synchronization to and from remote. Multiple browser windows are supported.
126129
@@ -142,37 +145,37 @@ A local table can be synchronized with only one remote table.
142145
143146
A remote table can be synchronized with one or more local tables.
144147
145-
#### sync.emptyTable(table)
148+
### sync.emptyTable(table)
146149
147150
Removes all records from a local table without synchronizing them as deleted to the server.
148151
149152
- `table`: [Dexie.js Table](https://dexie.org/docs/Dexie/Dexie.%5Btable%5D)
150153
151-
#### sync.reset()
154+
### sync.reset()
152155
153156
Resets all synchronizations. All local and remote documents are synchronized again.
154157
155158
- `database`: [Dexie.js Database](https://dexie.org/docs/Dexie/Dexie)
156159
157-
#### sync.register(username, password)
160+
### sync.register(username, password)
158161
159162
Creates a new user.
160163
161-
#### sync.login(username, password)
164+
### sync.login(username, password)
162165
163166
Logs the user in, clears all local tables and resets the synchronization.
164167
165-
#### sync.password(username, password, newPassword)
168+
### sync.password(username, password, newPassword)
166169
167170
Updates the password of the user.
168171
169-
#### sync.user(callback)
172+
### sync.user(callback)
170173
171174
Returns the use details or null.
172175
173176
- `callback`: `<function>` *optional*, callback on any user change with user details or null
174177
175-
#### sync.logout()
178+
### sync.logout()
176179
177180
Logs the user out, clears all local tables and resets the synchronization.
178181

0 commit comments

Comments
 (0)