mirror of
https://github.com/jacobtread/obsidian-timekeep.git
synced 2026-07-22 10:10:27 +00:00
docs: update readme api docs
This commit is contained in:
parent
43e8bb2b29
commit
88f9002735
1 changed files with 5 additions and 5 deletions
10
README.md
10
README.md
|
|
@ -110,10 +110,10 @@ You can access the plugin API through:
|
|||
|
||||
```js
|
||||
// Get the timekeep plugin API
|
||||
const timekeepPlugin = this.app.plugins.plugins.timekeep;
|
||||
const timekeepPlugin = this.app.plugins.plugins.timekeep.api;
|
||||
|
||||
// Extract the timekeeps from the file text
|
||||
const timekeeps = timekeepPlugin.extractTimekeepCodeblocks(text);
|
||||
const timekeeps = timekeepPlugin.parser.extractTimekeepCodeblocks(text);
|
||||
```
|
||||
|
||||
Below is a Dataview example for showing the total elapsed time for all timekeeps in the current file:
|
||||
|
|
@ -128,10 +128,10 @@ if(!activeFile || !activeFile.name) return;
|
|||
const text = await this.app.vault.read(activeFile);
|
||||
|
||||
// Get the timekeep plugin API
|
||||
const timekeepPlugin = this.app.plugins.plugins.timekeep;
|
||||
const timekeepPlugin = this.app.plugins.plugins.timekeep.api;
|
||||
|
||||
// Extract the timekeeps from the file text
|
||||
const timekeeps = timekeepPlugin.extractTimekeepCodeblocks(text);
|
||||
const timekeeps = timekeepPlugin.parser.extractTimekeepCodeblocks(text);
|
||||
|
||||
// Current time is required for unfinished entries
|
||||
const currentTime = moment();
|
||||
|
|
@ -139,7 +139,7 @@ const currentTime = moment();
|
|||
let totalRunningDuration = 0;
|
||||
|
||||
for (const timekeep of timekeeps) {
|
||||
totalRunningDuration += timekeepPlugin.getTotalDuration(timekeep.entries, currentTime);
|
||||
totalRunningDuration += timekeepPlugin.queries.getTotalDuration(timekeep.entries, currentTime);
|
||||
}
|
||||
|
||||
// Total running duration is in milliseconds
|
||||
|
|
|
|||
Loading…
Reference in a new issue