-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removes deep link logic, moves widget updating to 'itemChange' events
- Loading branch information
Showing
7 changed files
with
49 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { RecentsWidget } from './RecentsWidget'; | ||
import Note from '@joplin/lib/models/Note'; | ||
import { reg } from '@joplin/lib/registry'; | ||
import shim from '@joplin/lib/shim'; | ||
|
||
const MAX_COUNT = 10; | ||
const DEBOUNCE_TIMEOUT = 5000; | ||
|
||
export async function updateRecentsWidget() { | ||
reg.logger().info('updating recents widget'); | ||
const recents = await Note.all({ | ||
fields: ['id', 'title'], | ||
order: [{ by: 'updated_time', dir: 'DESC' }], | ||
limit: MAX_COUNT, | ||
}); | ||
return RecentsWidget.write({ | ||
notes: recents, | ||
}); | ||
} | ||
|
||
let hasUpdateScheduled = false; | ||
|
||
export function updateRecentsWidgetWithDebounce() { | ||
if (hasUpdateScheduled) { | ||
return; | ||
} | ||
hasUpdateScheduled = true; | ||
shim.setTimeout(async () => { | ||
await updateRecentsWidget(); | ||
hasUpdateScheduled = false; | ||
}, DEBOUNCE_TIMEOUT); | ||
} |
This file was deleted.
Oops, something went wrong.