entities_fbranch.js.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Source: entities/fbranch.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/fbranch.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 FBranch {
  24. constructor(froca, row) {
  25. /** @type {Froca} */
  26. this.froca = froca;
  27. this.update(row);
  28. }
  29. update(row) {
  30. /**
  31. * primary key
  32. * @type {string}
  33. */
  34. this.branchId = row.branchId;
  35. /** @type {string} */
  36. this.noteId = row.noteId;
  37. /** @type {string} */
  38. this.parentNoteId = row.parentNoteId;
  39. /** @type {int} */
  40. this.notePosition = row.notePosition;
  41. /** @type {string} */
  42. this.prefix = row.prefix;
  43. /** @type {boolean} */
  44. this.isExpanded = !!row.isExpanded;
  45. /** @type {boolean} */
  46. this.fromSearchNote = !!row.fromSearchNote;
  47. }
  48. /** @returns {FNote} */
  49. async getNote() {
  50. return this.froca.getNote(this.noteId);
  51. }
  52. /** @returns {FNote} */
  53. getNoteFromCache() {
  54. return this.froca.getNoteFromCache(this.noteId);
  55. }
  56. /** @returns {FNote} */
  57. async getParentNote() {
  58. return this.froca.getNote(this.parentNoteId);
  59. }
  60. /** @returns {boolean} true if it's top level, meaning its parent is the root note */
  61. isTopLevel() {
  62. return this.parentNoteId === 'root';
  63. }
  64. get toString() {
  65. return `FBranch(branchId=${this.branchId})`;
  66. }
  67. get pojo() {
  68. const pojo = {...this};
  69. delete pojo.froca;
  70. return pojo;
  71. }
  72. }
  73. export default FBranch;
  74. </code></pre>
  75. </article>
  76. </section>
  77. </div>
  78. <nav>
  79. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BasicWidget.html">BasicWidget</a></li><li><a href="FAttachment.html">FAttachment</a></li><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteContextAwareWidget.html">NoteContextAwareWidget</a></li><li><a href="RightPanelWidget.html">RightPanelWidget</a></li></ul><h3>Global</h3><ul><li><a href="global.html#api">api</a></li><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>
  80. </nav>
  81. <br class="clear">
  82. <footer>
  83. Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a>
  84. </footer>
  85. <script> prettyPrint(); </script>
  86. <script src="scripts/linenumber.js"> </script>
  87. </body>
  88. </html>