entities_branch.js.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Source: entities/branch.js</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Source: entities/branch.js</h1>
  17. <section>
  18. <article>
  19. <pre class="prettyprint source linenums"><code>/**
  20. * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
  21. * parents.
  22. */
  23. class Branch {
  24. constructor(froca, row) {
  25. this.froca = froca;
  26. this.update(row);
  27. }
  28. update(row) {
  29. /**
  30. * primary key
  31. * @type {string}
  32. */
  33. this.branchId = row.branchId;
  34. /** @type {string} */
  35. this.noteId = row.noteId;
  36. /** @type {string} */
  37. this.parentNoteId = row.parentNoteId;
  38. /** @type {int} */
  39. this.notePosition = row.notePosition;
  40. /** @type {string} */
  41. this.prefix = row.prefix;
  42. /** @type {boolean} */
  43. this.isExpanded = !!row.isExpanded;
  44. /** @type {boolean} */
  45. this.fromSearchNote = !!row.fromSearchNote;
  46. }
  47. /** @returns {NoteShort} */
  48. async getNote() {
  49. return this.froca.getNote(this.noteId);
  50. }
  51. /** @returns {NoteShort} */
  52. getNoteFromCache() {
  53. return this.froca.getNoteFromCache(this.noteId);
  54. }
  55. /** @returns {NoteShort} */
  56. async getParentNote() {
  57. return this.froca.getNote(this.parentNoteId);
  58. }
  59. /** @returns {boolean} true if it's top level, meaning its parent is root note */
  60. isTopLevel() {
  61. return this.parentNoteId === 'root';
  62. }
  63. get toString() {
  64. return `Branch(branchId=${this.branchId})`;
  65. }
  66. }
  67. export default Branch;
  68. </code></pre>
  69. </article>
  70. </section>
  71. </div>
  72. <nav>
  73. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
  74. </nav>
  75. <br class="clear">
  76. <footer>
  77. Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a>
  78. </footer>
  79. <script> prettyPrint(); </script>
  80. <script src="scripts/linenumber.js"> </script>
  81. </body>
  82. </html>