イベントを捕捉するUserScript
code:script.js
(() => {
const linesChanged = () => {
console.log(linesChanged: ${scrapbox.Page.lines.length});
};
let currentProject = scrapbox.Project.name;
const projectChanged = () => {
console.log(projectChanged: ${currentProject} => ${scrapbox.Project.name});
currentProject = scrapbox.Project.name;
};
const pageChanged = () => {
console.log(pageChanged: title ${scrapbox.Page.title});
};
const layoutChanged = () => {
console.log(layoutChanged: ${scrapbox.Layout});
switch(scrapbox.Layout) {
case 'page':
break;
case 'list':
break;
default:
break;
}
};
scrapbox.on(lines:changed, linesChanged);
scrapbox.on(project:changed, projectChanged);
scrapbox.on(page:changed, pageChanged);
scrapbox.on(layout:changed, layoutChanged);
})();
更新履歴
どんな風にEventが捕捉できるのか確認する用(2021/12/16)