Skip to content

Commit

Permalink
perf: update app.js
Browse files Browse the repository at this point in the history
  • Loading branch information
oeyoews committed Feb 26, 2025
1 parent 05d8793 commit 96118c2
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions plugins/oeyoews/neotw-tiddlers-view/tiddlers/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ const app = () => {
currentIndex: 0,
lastUpdateTime: 0,
animationFrameId: null,
visibleTitles: [],
filter:
'[!is[system]sort[title]!is[tag]!prefix[$:/]!is[binary]!is[draft]]',
};
},
mounted() {
console.log('App mounted!');
this.loadTitles();
this.startScrolling();
},
Expand All @@ -37,23 +35,18 @@ const app = () => {

loadTitles() {
if ($tw && $tw.wiki) {
const tiddlers = $tw.wiki.filterTiddlers(this.filter);
this.allTitles = tiddlers;
this.updateCurrentTitle();
this.allTitles = $tw.wiki.filterTiddlers(this.filter);
this.currentTitle = this.updateCurrentTitle();
} else {
console.error('TiddlyWiki API not available');
}
},

updateCurrentTitle() {
if (this.allTitles.length === 0) {
this.currentTitle = '';
return;
return null;
}

// 只显示一个标题
const index = this.currentIndex % this.allTitles.length;
this.currentTitle = this.allTitles[index];
return this.allTitles[index];
},

startScrolling() {
Expand Down

0 comments on commit 96118c2

Please sign in to comment.