entities_fblob.js.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Source: entities/fblob.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/fblob.js</h1>
  17. <section>
  18. <article>
  19. <pre class="prettyprint source linenums"><code>export default class FBlob {
  20. constructor(row) {
  21. /** @type {string} */
  22. this.blobId = row.blobId;
  23. /**
  24. * can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images)
  25. * @type {string}
  26. */
  27. this.content = row.content;
  28. this.contentLength = row.contentLength;
  29. /** @type {string} */
  30. this.dateModified = row.dateModified;
  31. /** @type {string} */
  32. this.utcDateModified = row.utcDateModified;
  33. }
  34. /**
  35. * @returns {*}
  36. * @throws Error in case of invalid JSON */
  37. getJsonContent() {
  38. if (!this.content || !this.content.trim()) {
  39. return null;
  40. }
  41. return JSON.parse(this.content);
  42. }
  43. /** @returns {*|null} valid object or null if the content cannot be parsed as JSON */
  44. getJsonContentSafely() {
  45. try {
  46. return this.getJsonContent();
  47. }
  48. catch (e) {
  49. return null;
  50. }
  51. }
  52. }
  53. </code></pre>
  54. </article>
  55. </section>
  56. </div>
  57. <nav>
  58. <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>
  59. </nav>
  60. <br class="clear">
  61. <footer>
  62. Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a>
  63. </footer>
  64. <script> prettyPrint(); </script>
  65. <script src="scripts/linenumber.js"> </script>
  66. </body>
  67. </html>