tauri-notice-window 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/db.d.ts +5 -0
- package/dist/utils/db.d.ts.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -307,6 +307,115 @@ setNoticeConfig({
|
|
|
307
307
|
})
|
|
308
308
|
```
|
|
309
309
|
|
|
310
|
+
### Database Utilities
|
|
311
|
+
|
|
312
|
+
For advanced use cases, direct database access is available:
|
|
313
|
+
|
|
314
|
+
#### saveMessage()
|
|
315
|
+
|
|
316
|
+
Save a message to the database.
|
|
317
|
+
|
|
318
|
+
```typescript
|
|
319
|
+
import { saveMessage } from 'tauri-notice-window'
|
|
320
|
+
|
|
321
|
+
await saveMessage({
|
|
322
|
+
id: '123',
|
|
323
|
+
title: 'Notice',
|
|
324
|
+
type: 'announcement',
|
|
325
|
+
data: { content: 'Message content' }
|
|
326
|
+
})
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
#### getMessage()
|
|
330
|
+
|
|
331
|
+
Retrieve a message by ID.
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
import { getMessage } from 'tauri-notice-window'
|
|
335
|
+
|
|
336
|
+
const message = await getMessage('123')
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
#### deleteMessageById()
|
|
340
|
+
|
|
341
|
+
Delete a message by ID.
|
|
342
|
+
|
|
343
|
+
```typescript
|
|
344
|
+
import { deleteMessageById } from 'tauri-notice-window'
|
|
345
|
+
|
|
346
|
+
await deleteMessageById('123')
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
#### hasMessage()
|
|
350
|
+
|
|
351
|
+
Check if a message exists in the database.
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
import { hasMessage } from 'tauri-notice-window'
|
|
355
|
+
|
|
356
|
+
const exists = await hasMessage('123')
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
#### isMessageShown()
|
|
360
|
+
|
|
361
|
+
Check if a message was already shown.
|
|
362
|
+
|
|
363
|
+
```typescript
|
|
364
|
+
import { isMessageShown } from 'tauri-notice-window'
|
|
365
|
+
|
|
366
|
+
const shown = await isMessageShown('123')
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
#### getPendingMessages()
|
|
370
|
+
|
|
371
|
+
Get all pending messages.
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
import { getPendingMessages } from 'tauri-notice-window'
|
|
375
|
+
|
|
376
|
+
const pending = await getPendingMessages()
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
#### updateQueueStatus()
|
|
380
|
+
|
|
381
|
+
Update the queue status of a message.
|
|
382
|
+
|
|
383
|
+
```typescript
|
|
384
|
+
import { updateQueueStatus } from 'tauri-notice-window'
|
|
385
|
+
|
|
386
|
+
await updateQueueStatus('123', 'shown')
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
#### markAsShown()
|
|
390
|
+
|
|
391
|
+
Mark a message as shown.
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
import { markAsShown } from 'tauri-notice-window'
|
|
395
|
+
|
|
396
|
+
await markAsShown('123')
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
#### markAsHidden()
|
|
400
|
+
|
|
401
|
+
Mark a message as hidden.
|
|
402
|
+
|
|
403
|
+
```typescript
|
|
404
|
+
import { markAsHidden } from 'tauri-notice-window'
|
|
405
|
+
|
|
406
|
+
await markAsHidden('123')
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
#### clearPendingMessages()
|
|
410
|
+
|
|
411
|
+
Clear all pending and showing messages.
|
|
412
|
+
|
|
413
|
+
```typescript
|
|
414
|
+
import { clearPendingMessages } from 'tauri-notice-window'
|
|
415
|
+
|
|
416
|
+
await clearPendingMessages()
|
|
417
|
+
```
|
|
418
|
+
|
|
310
419
|
## Routing Setup
|
|
311
420
|
|
|
312
421
|
The library expects routes to match the pattern: `{routePrefix}/{message.type}`
|