All files index.js

100% Statements 9/9
100% Branches 2/2
100% Functions 4/4
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44    3x   3x                                         3x 1x 2x 1x 1x 1x                 1x        
 import Extension from "./extension.js";
 import postRobot from "post-robot";
 const version = "1.0.0"
 
 postRobot.CONFIG.LOG_LEVEL = 'error';
 
 /**Class to intialize the plugin on Contentstack ui. */
 
 class ContentstackUIExtension {
 
   /**
    * You need to first include Contentstack UI Extensions SDK and Contentstack UI Stylesheet in you HTML file and then call ContentstackUIExtension.init in the script tag.
    * @example
    * HTML
    * <script src="https://sdklink"></script>
    * <link href="https://style sheet link" rel="stylesheet" >
    * @example
    * // javascript 
    * ContentstackUIExtension.init().then(function (extension) {
    *     var value = extension.field.getData()
    *     extension.field.setData("New Field Data")
    * })
    * @return {Extension} An Extension object, will contain all the data recived from the Contentstack UI.
    */
   static init() {
     if (this._extension)
       return Promise.resolve(this._extension)
     return Extension.initialize().then((initializationData) => {
       this._extension = new Extension(initializationData)
       return Promise.resolve(this._extension)
     }).catch((e) => Promise.reject(e))
   }
 
 
   /**
    * Version of Contentstack ui extension.
    * @type {string}
    */
   static get SDK_VERSION() {
     return version;
   }
 }
 
 export default ContentstackUIExtension;