Using Javascript classes in Templater

Part of Obsidian guides

Script file

// filename.js
class SomeLib {
  functionOne() {new Notice("functionOne", 5000)}
  functionTwo() {new Notice("functionTwo", 5000)}
  functionThree() {new Notice("functionThree", 5000)}
  functionFour() {new Notice("functionFour", 5000)}
  functionFive() {new Notice("functionFive", 5000)}
}
module.exports = SomeLib

Template

<%* 
// Templater Template
const foo = new tp.user.filename;
foo.functionTwo();
%>
Published with Obsidian Share