/ docs / plugin_reference.html
plugin_reference.html
   1  <!DOCTYPE html>
   2  <html lang="en" dir="ltr">
   3    <head prefix="og: http://ogp.me/ns#">
   4    <meta charset="utf-8">
   5    <title>Plugin APIs | Embark</title>
   6    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
   7    <meta name="viewport" content="width=device-width, initial-scale=1">
   8    <!-- Canonical links -->
   9    <link rel="canonical" href="https://framework.embarklabs.io/docs/plugin_reference.html">
  10    <!-- Alternative links -->
  11    
  12  
  13    <!-- Icon -->
  14    <meta name="msapplication-TileColor" content="#080E1A">
  15    <link rel="icon" type="image/png" href="/assets/images/favicon-16.png" sizes="16x16" />
  16    <link rel="icon" type="image/png" href="/assets/images/favicon-32.png" sizes="32x32" />
  17  
  18    <link rel="apple-touch-icon" sizes="76x76" href="/assets/images/apple-touch-icon-60x60-precomposed.png">
  19    <link rel="apple-touch-icon" sizes="76x76" href="/assets/images/apple-touch-icon-76x76-precomposed.png">
  20    <link rel="apple-touch-icon" sizes="120x120" href="/assets/images/apple-touch-icon-120x120-precomposed.png">
  21    <link rel="apple-touch-icon" sizes="152x152" href="/assets/images/apple-touch-icon-152x152-precomposed.png">
  22    <link rel="apple-touch-icon" sizes="180x180" href="/assets/images/apple-touch-icon-precomposed.png">
  23    <link rel="apple-touch-icon" href="/assets/images/apple-touch-icon-precomposed.png">
  24    <!-- CSS -->
  25    
  26  <link rel="stylesheet" href="/css/embark.css">
  27  
  28    <!-- endbuild -->
  29  
  30    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
  31    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />
  32  
  33    <!-- RSS -->
  34    <link rel="alternate" href="/atom.xml" title="Embark">
  35    <meta property="og:image" content="/img/share.png?v=0.0.5" />
  36    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.4/styles/dracula.min.css">
  37  
  38    <script async defer src="https://buttons.github.io/buttons.js"></script>
  39  
  40  
  41  <script>
  42    !function(root, factory) {
  43      "function" == typeof define && define.amd ? // AMD. Register as an anonymous module unless amdModuleId is set
  44      define([], function() {
  45          return root.svg4everybody = factory();
  46      }) : "object" == typeof module && module.exports ? // Node. Does not work with strict CommonJS, but
  47      // only CommonJS-like environments that support module.exports,
  48      // like Node.
  49      module.exports = factory() : root.svg4everybody = factory();
  50  }(this, function() {
  51      /*! svg4everybody v2.1.9 | github.com/jonathantneal/svg4everybody */
  52      function embed(parent, svg, target) {
  53          // if the target exists
  54          if (target) {
  55              // create a document fragment to hold the contents of the target
  56              var fragment = document.createDocumentFragment(), viewBox = !svg.hasAttribute("viewBox") && target.getAttribute("viewBox");
  57              // conditionally set the viewBox on the svg
  58              viewBox && svg.setAttribute("viewBox", viewBox);
  59              // copy the contents of the clone into the fragment
  60              for (// clone the target
  61              var clone = target.cloneNode(!0); clone.childNodes.length; ) {
  62                  fragment.appendChild(clone.firstChild);
  63              }
  64              // append the fragment into the svg
  65              parent.appendChild(fragment);
  66          }
  67      }
  68      function loadreadystatechange(xhr) {
  69          // listen to changes in the request
  70          xhr.onreadystatechange = function() {
  71              // if the request is ready
  72              if (4 === xhr.readyState) {
  73                  // get the cached html document
  74                  var cachedDocument = xhr._cachedDocument;
  75                  // ensure the cached html document based on the xhr response
  76                  cachedDocument || (cachedDocument = xhr._cachedDocument = document.implementation.createHTMLDocument(""),
  77                  cachedDocument.body.innerHTML = xhr.responseText, xhr._cachedTarget = {}), // clear the xhr embeds list and embed each item
  78                  xhr._embeds.splice(0).map(function(item) {
  79                      // get the cached target
  80                      var target = xhr._cachedTarget[item.id];
  81                      // ensure the cached target
  82                      target || (target = xhr._cachedTarget[item.id] = cachedDocument.getElementById(item.id)),
  83                      // embed the target into the svg
  84                      embed(item.parent, item.svg, target);
  85                  });
  86              }
  87          }, // test the ready state change immediately
  88          xhr.onreadystatechange();
  89      }
  90      function svg4everybody(rawopts) {
  91          function oninterval() {
  92              // while the index exists in the live <use> collection
  93              for (// get the cached <use> index
  94              var index = 0; index < uses.length; ) {
  95                  // get the current <use>
  96                  var use = uses[index], parent = use.parentNode, svg = getSVGAncestor(parent), src = use.getAttribute("xlink:href") || use.getAttribute("href");
  97                  if (!src && opts.attributeName && (src = use.getAttribute(opts.attributeName)),
  98                  svg && src) {
  99                      if (polyfill) {
 100                          if (!opts.validate || opts.validate(src, svg, use)) {
 101                              // remove the <use> element
 102                              parent.removeChild(use);
 103                              // parse the src and get the url and id
 104                              var srcSplit = src.split("#"), url = srcSplit.shift(), id = srcSplit.join("#");
 105                              // if the link is external
 106                              if (url.length) {
 107                                  // get the cached xhr request
 108                                  var xhr = requests[url];
 109                                  // ensure the xhr request exists
 110                                  xhr || (xhr = requests[url] = new XMLHttpRequest(), xhr.open("GET", url), xhr.send(),
 111                                  xhr._embeds = []), // add the svg and id as an item to the xhr embeds list
 112                                  xhr._embeds.push({
 113                                      parent: parent,
 114                                      svg: svg,
 115                                      id: id
 116                                  }), // prepare the xhr ready state change event
 117                                  loadreadystatechange(xhr);
 118                              } else {
 119                                  // embed the local id into the svg
 120                                  embed(parent, svg, document.getElementById(id));
 121                              }
 122                          } else {
 123                              // increase the index when the previous value was not "valid"
 124                              ++index, ++numberOfSvgUseElementsToBypass;
 125                          }
 126                      }
 127                  } else {
 128                      // increase the index when the previous value was not "valid"
 129                      ++index;
 130                  }
 131              }
 132              // continue the interval
 133              (!uses.length || uses.length - numberOfSvgUseElementsToBypass > 0) && requestAnimationFrame(oninterval, 67);
 134          }
 135          var polyfill, opts = Object(rawopts), newerIEUA = /\bTrident\/[567]\b|\bMSIE (?:9|10)\.0\b/, webkitUA = /\bAppleWebKit\/(\d+)\b/, olderEdgeUA = /\bEdge\/12\.(\d+)\b/, edgeUA = /\bEdge\/.(\d+)\b/, inIframe = window.top !== window.self;
 136          polyfill = "polyfill" in opts ? opts.polyfill : newerIEUA.test(navigator.userAgent) || (navigator.userAgent.match(olderEdgeUA) || [])[1] < 10547 || (navigator.userAgent.match(webkitUA) || [])[1] < 537 || edgeUA.test(navigator.userAgent) && inIframe;
 137          // create xhr requests object
 138          var requests = {}, requestAnimationFrame = window.requestAnimationFrame || setTimeout, uses = document.getElementsByTagName("use"), numberOfSvgUseElementsToBypass = 0;
 139          // conditionally start the interval if the polyfill is active
 140          polyfill && oninterval();
 141      }
 142      function getSVGAncestor(node) {
 143          for (var svg = node; "svg" !== svg.nodeName.toLowerCase() && (svg = svg.parentNode); ) {}
 144          return svg;
 145      }
 146      return svg4everybody;
 147  });
 148  
 149  svg4everybody();
 150  </script>
 151  </head>
 152  
 153    <body>
 154      <header role="banner" class="c-header c-header--compact">
 155    <span class="c-header__background"></span>
 156    <div class="o-container c-header__content">
 157      <div class="c-header__top">
 158        <a href="/" title="Embark" class="c-logo c-logo--negative">Embark</a>
 159        <nav role="navigation" class="c-navigation">
 160          <div class="c-navigation__header">
 161            <a href="/" title="Embark" class="c-logo">Embark</a>
 162            <button class="c-navigation__close u-text-light" title="Close menu">
 163              <svg class="c-icon c-icon--xs"><use xlink:href="/../assets/icons/symbols.svg#icon-close"></use></svg>
 164            </button>
 165          </div>
 166          <div class="c-navigation__body">
 167            <ul class="c-navigation__list">
 168              <li class="c-navigation__item">
 169                <a href="/docs/quick_start.html" class="c-navigation__anchor " title="Quick Start">Quick Start</a>
 170              </li>
 171              <li class="c-navigation__item">
 172                <a href="/docs" class="c-navigation__anchor is-active" title="Learn">Learn</a>
 173              </li>
 174              <li class="c-navigation__item">
 175                <a href="/plugins" class="c-navigation__anchor " title="Plugins">Plugins</a>
 176              </li>
 177              <li class="c-navigation__item">
 178                <a href="/community" class="c-navigation__anchor " title="Community">Community</a>
 179              </li>
 180              <li class="c-navigation__item">
 181                <a href="https://blog.embarklabs.io" target="_blank" rel="noopener" class="c-navigation__anchor " title="Blog">Blog</a>
 182              </li>
 183            </ul>
 184          </div>
 185        </nav>
 186        <div class="o-flex o-flex-center">
 187          <form action="" class="o-flex__item u-hidden-until-large">
 188            <input type="search" placeholder="Search" id="search-input">
 189          </form>
 190          <div class="o-flex__item">
 191            <ul class="o-flex o-flex-center">
 192              <li class="o-flex__item">
 193                <a href="https://github.com/embarklabs/embark" title="Github" target="_blank" class="u-link-ghost">
 194                  <svg class="c-icon"><use xlink:href="/../assets/icons/symbols.svg#icon-github"></use></svg>
 195                </a>
 196              </li>
 197              <li class="o-flex__item">
 198                <a href="https://twitter.com/EmbarkProject" title="Twitter" target="_blank">
 199                  <svg class="c-icon"><use xlink:href="/../assets/icons/symbols.svg#icon-twitter"></use></svg>
 200                </a>
 201              </li>
 202              <li class="o-flex__item u-hidden-large-up">
 203                <button type="button"class="c-navigation__trigger u-link-ghost" title="Open menu">
 204                  <svg class="c-icon"><use xlink:href="/../assets/icons/symbols.svg#icon-navigation-menu"></use></svg>
 205                </button>
 206              </li>
 207            </ul>
 208          </div>
 209        </div>
 210      </div>
 211      <div class="c-quick-search o-distance-m u-hidden-large-up">
 212        <input type="search" id="inp-search" placeholder="Search">
 213      </div>
 214      <div class="c-header__body">
 215        <h1 class="c-title u-text-ghost">Documentation</h1>
 216  
 217        
 218  
 219        
 220        
 221      </div>
 222    </div>
 223  </header>
 224  
 225  
 226  <main role="main">
 227    <section class="o-guided-content o-distance">
 228      <div class="o-guided-content__wrapper">
 229        <button title="Open docs menu" id="guides-trigger" class="c-button c-button--minion u-hidden-large-up">
 230          <svg class="c-icon c-icon--xs"><use xlink:href="/../../assets/icons/symbols.svg#icon-navigation-menu"></use></svg>
 231          <span>Guides</span>
 232        </button>
 233        <div class="c-guide o-guided-content__guide"  id="guide-navigation">
 234          <div class="c-guide__header u-hidden-large-up">
 235            <a href="" title="Guides">
 236              Guides
 237            </a>
 238            <button type="button" title="Close menu" id="guides-close">
 239              <svg class="c-icon c-icon--xs"><use xlink:href="/../../assets/icons/symbols.svg#icon-close"></use></svg>
 240            </button>
 241          </div>
 242          <div class="c-guide__body">
 243            <nav role="navigation">
 244              
 245                <div class="">
 246                  <h3 class="c-category-title">Getting Started</h3>
 247                  <ul class="o-list-bare">
 248                    
 249                    <li class="o-list-bare__item">
 250                      <a href="/docs/overview.html" title="Overview" class="u-link-uniform ">Overview</a>
 251                      <!-- <div class="o-distance-m">
 252                        <ul class="o-list-bare c-navigation__subnav">
 253                          <li class="o-list-bare__item">
 254                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 255                          </li>
 256                        </ul>
 257                      </div> -->
 258                    </li>
 259                    
 260                    <li class="o-list-bare__item">
 261                      <a href="/docs/installation.html" title="Installation" class="u-link-uniform ">Installation</a>
 262                      <!-- <div class="o-distance-m">
 263                        <ul class="o-list-bare c-navigation__subnav">
 264                          <li class="o-list-bare__item">
 265                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 266                          </li>
 267                        </ul>
 268                      </div> -->
 269                    </li>
 270                    
 271                    <li class="o-list-bare__item">
 272                      <a href="/docs/faq.html" title="FAQ" class="u-link-uniform ">FAQ</a>
 273                      <!-- <div class="o-distance-m">
 274                        <ul class="o-list-bare c-navigation__subnav">
 275                          <li class="o-list-bare__item">
 276                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 277                          </li>
 278                        </ul>
 279                      </div> -->
 280                    </li>
 281                    
 282                  </ul>
 283                
 284              
 285                <div class="o-distance-xl">
 286                  <h3 class="c-category-title">General Usage</h3>
 287                  <ul class="o-list-bare">
 288                    
 289                    <li class="o-list-bare__item">
 290                      <a href="/docs/create_project.html" title="Creating apps" class="u-link-uniform ">Creating apps</a>
 291                      <!-- <div class="o-distance-m">
 292                        <ul class="o-list-bare c-navigation__subnav">
 293                          <li class="o-list-bare__item">
 294                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 295                          </li>
 296                        </ul>
 297                      </div> -->
 298                    </li>
 299                    
 300                    <li class="o-list-bare__item">
 301                      <a href="/docs/structure.html" title="App structure" class="u-link-uniform ">App structure</a>
 302                      <!-- <div class="o-distance-m">
 303                        <ul class="o-list-bare c-navigation__subnav">
 304                          <li class="o-list-bare__item">
 305                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 306                          </li>
 307                        </ul>
 308                      </div> -->
 309                    </li>
 310                    
 311                    <li class="o-list-bare__item">
 312                      <a href="/docs/running_apps.html" title="Running apps" class="u-link-uniform ">Running apps</a>
 313                      <!-- <div class="o-distance-m">
 314                        <ul class="o-list-bare c-navigation__subnav">
 315                          <li class="o-list-bare__item">
 316                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 317                          </li>
 318                        </ul>
 319                      </div> -->
 320                    </li>
 321                    
 322                    <li class="o-list-bare__item">
 323                      <a href="/docs/dashboard.html" title="Using the dashboard" class="u-link-uniform ">Using the dashboard</a>
 324                      <!-- <div class="o-distance-m">
 325                        <ul class="o-list-bare c-navigation__subnav">
 326                          <li class="o-list-bare__item">
 327                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 328                          </li>
 329                        </ul>
 330                      </div> -->
 331                    </li>
 332                    
 333                    <li class="o-list-bare__item">
 334                      <a href="/docs/using_the_console.html" title="Using the console" class="u-link-uniform ">Using the console</a>
 335                      <!-- <div class="o-distance-m">
 336                        <ul class="o-list-bare c-navigation__subnav">
 337                          <li class="o-list-bare__item">
 338                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 339                          </li>
 340                        </ul>
 341                      </div> -->
 342                    </li>
 343                    
 344                    <li class="o-list-bare__item">
 345                      <a href="/docs/environments.html" title="Environments" class="u-link-uniform ">Environments</a>
 346                      <!-- <div class="o-distance-m">
 347                        <ul class="o-list-bare c-navigation__subnav">
 348                          <li class="o-list-bare__item">
 349                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 350                          </li>
 351                        </ul>
 352                      </div> -->
 353                    </li>
 354                    
 355                    <li class="o-list-bare__item">
 356                      <a href="/docs/configuration.html" title="Configuration" class="u-link-uniform ">Configuration</a>
 357                      <!-- <div class="o-distance-m">
 358                        <ul class="o-list-bare c-navigation__subnav">
 359                          <li class="o-list-bare__item">
 360                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 361                          </li>
 362                        </ul>
 363                      </div> -->
 364                    </li>
 365                    
 366                    <li class="o-list-bare__item">
 367                      <a href="/docs/pipeline_and_webpack.html" title="Building & Compiling" class="u-link-uniform ">Building & Compiling</a>
 368                      <!-- <div class="o-distance-m">
 369                        <ul class="o-list-bare c-navigation__subnav">
 370                          <li class="o-list-bare__item">
 371                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 372                          </li>
 373                        </ul>
 374                      </div> -->
 375                    </li>
 376                    
 377                    <li class="o-list-bare__item">
 378                      <a href="/docs/executing_scripts.html" title="Executing Scripts" class="u-link-uniform ">Executing Scripts</a>
 379                      <!-- <div class="o-distance-m">
 380                        <ul class="o-list-bare c-navigation__subnav">
 381                          <li class="o-list-bare__item">
 382                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 383                          </li>
 384                        </ul>
 385                      </div> -->
 386                    </li>
 387                    
 388                    <li class="o-list-bare__item">
 389                      <a href="/docs/javascript_usage.html" title="Using EmbarkJS" class="u-link-uniform ">Using EmbarkJS</a>
 390                      <!-- <div class="o-distance-m">
 391                        <ul class="o-list-bare c-navigation__subnav">
 392                          <li class="o-list-bare__item">
 393                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 394                          </li>
 395                        </ul>
 396                      </div> -->
 397                    </li>
 398                    
 399                  </ul>
 400                </div>
 401              
 402                <div class="o-distance-xl">
 403                  <h3 class="c-category-title">Smart Contract Development</h3>
 404                  <ul class="o-list-bare">
 405                    
 406                    <li class="o-list-bare__item">
 407                      <a href="/docs/contracts_configuration.html" title="Configuration" class="u-link-uniform ">Configuration</a>
 408                      <!-- <div class="o-distance-m">
 409                        <ul class="o-list-bare c-navigation__subnav">
 410                          <li class="o-list-bare__item">
 411                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 412                          </li>
 413                        </ul>
 414                      </div> -->
 415                    </li>
 416                    
 417                    <li class="o-list-bare__item">
 418                      <a href="/docs/contracts_deployment.html" title="Accounts & Deployment" class="u-link-uniform ">Accounts & Deployment</a>
 419                      <!-- <div class="o-distance-m">
 420                        <ul class="o-list-bare c-navigation__subnav">
 421                          <li class="o-list-bare__item">
 422                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 423                          </li>
 424                        </ul>
 425                      </div> -->
 426                    </li>
 427                    
 428                    <li class="o-list-bare__item">
 429                      <a href="/docs/contracts_imports.html" title="Special Imports" class="u-link-uniform ">Special Imports</a>
 430                      <!-- <div class="o-distance-m">
 431                        <ul class="o-list-bare c-navigation__subnav">
 432                          <li class="o-list-bare__item">
 433                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 434                          </li>
 435                        </ul>
 436                      </div> -->
 437                    </li>
 438                    
 439                    <li class="o-list-bare__item">
 440                      <a href="/docs/contracts_testing.html" title="Testing" class="u-link-uniform ">Testing</a>
 441                      <!-- <div class="o-distance-m">
 442                        <ul class="o-list-bare c-navigation__subnav">
 443                          <li class="o-list-bare__item">
 444                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 445                          </li>
 446                        </ul>
 447                      </div> -->
 448                    </li>
 449                    
 450                    <li class="o-list-bare__item">
 451                      <a href="/docs/contracts_javascript.html" title="Smart Contracts in JavaScript" class="u-link-uniform ">Smart Contracts in JavaScript</a>
 452                      <!-- <div class="o-distance-m">
 453                        <ul class="o-list-bare c-navigation__subnav">
 454                          <li class="o-list-bare__item">
 455                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 456                          </li>
 457                        </ul>
 458                      </div> -->
 459                    </li>
 460                    
 461                  </ul>
 462                </div>
 463              
 464                <div class="o-distance-xl">
 465                  <h3 class="c-category-title">Blockchain Client</h3>
 466                  <ul class="o-list-bare">
 467                    
 468                    <li class="o-list-bare__item">
 469                      <a href="/docs/blockchain_configuration.html" title="Configuration" class="u-link-uniform ">Configuration</a>
 470                      <!-- <div class="o-distance-m">
 471                        <ul class="o-list-bare c-navigation__subnav">
 472                          <li class="o-list-bare__item">
 473                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 474                          </li>
 475                        </ul>
 476                      </div> -->
 477                    </li>
 478                    
 479                    <li class="o-list-bare__item">
 480                      <a href="/docs/blockchain_accounts_configuration.html" title="Managing Accounts" class="u-link-uniform ">Managing Accounts</a>
 481                      <!-- <div class="o-distance-m">
 482                        <ul class="o-list-bare c-navigation__subnav">
 483                          <li class="o-list-bare__item">
 484                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 485                          </li>
 486                        </ul>
 487                      </div> -->
 488                    </li>
 489                    
 490                  </ul>
 491                </div>
 492              
 493                <div class="o-distance-xl">
 494                  <h3 class="c-category-title">Storage (IPFS/Swarm)</h3>
 495                  <ul class="o-list-bare">
 496                    
 497                    <li class="o-list-bare__item">
 498                      <a href="/docs/storage_configuration.html" title="Configuration" class="u-link-uniform ">Configuration</a>
 499                      <!-- <div class="o-distance-m">
 500                        <ul class="o-list-bare c-navigation__subnav">
 501                          <li class="o-list-bare__item">
 502                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 503                          </li>
 504                        </ul>
 505                      </div> -->
 506                    </li>
 507                    
 508                    <li class="o-list-bare__item">
 509                      <a href="/docs/storage_deployment.html" title="Deploying apps" class="u-link-uniform ">Deploying apps</a>
 510                      <!-- <div class="o-distance-m">
 511                        <ul class="o-list-bare c-navigation__subnav">
 512                          <li class="o-list-bare__item">
 513                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 514                          </li>
 515                        </ul>
 516                      </div> -->
 517                    </li>
 518                    
 519                    <li class="o-list-bare__item">
 520                      <a href="/docs/storage_javascript.html" title="Storage APIs in JavaScript" class="u-link-uniform ">Storage APIs in JavaScript</a>
 521                      <!-- <div class="o-distance-m">
 522                        <ul class="o-list-bare c-navigation__subnav">
 523                          <li class="o-list-bare__item">
 524                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 525                          </li>
 526                        </ul>
 527                      </div> -->
 528                    </li>
 529                    
 530                  </ul>
 531                </div>
 532              
 533                <div class="o-distance-xl">
 534                  <h3 class="c-category-title">Messages (Whisper)</h3>
 535                  <ul class="o-list-bare">
 536                    
 537                    <li class="o-list-bare__item">
 538                      <a href="/docs/messages_configuration.html" title="Configuration" class="u-link-uniform ">Configuration</a>
 539                      <!-- <div class="o-distance-m">
 540                        <ul class="o-list-bare c-navigation__subnav">
 541                          <li class="o-list-bare__item">
 542                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 543                          </li>
 544                        </ul>
 545                      </div> -->
 546                    </li>
 547                    
 548                    <li class="o-list-bare__item">
 549                      <a href="/docs/messages_javascript.html" title="Messages in JavaScript" class="u-link-uniform ">Messages in JavaScript</a>
 550                      <!-- <div class="o-distance-m">
 551                        <ul class="o-list-bare c-navigation__subnav">
 552                          <li class="o-list-bare__item">
 553                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 554                          </li>
 555                        </ul>
 556                      </div> -->
 557                    </li>
 558                    
 559                  </ul>
 560                </div>
 561              
 562                <div class="o-distance-xl">
 563                  <h3 class="c-category-title">Naming Systems (ENS)</h3>
 564                  <ul class="o-list-bare">
 565                    
 566                    <li class="o-list-bare__item">
 567                      <a href="/docs/naming_configuration.html" title="Configuration" class="u-link-uniform ">Configuration</a>
 568                      <!-- <div class="o-distance-m">
 569                        <ul class="o-list-bare c-navigation__subnav">
 570                          <li class="o-list-bare__item">
 571                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 572                          </li>
 573                        </ul>
 574                      </div> -->
 575                    </li>
 576                    
 577                    <li class="o-list-bare__item">
 578                      <a href="/docs/naming_javascript.html" title="Naming Systems in JavaScript" class="u-link-uniform ">Naming Systems in JavaScript</a>
 579                      <!-- <div class="o-distance-m">
 580                        <ul class="o-list-bare c-navigation__subnav">
 581                          <li class="o-list-bare__item">
 582                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 583                          </li>
 584                        </ul>
 585                      </div> -->
 586                    </li>
 587                    
 588                  </ul>
 589                </div>
 590              
 591                <div class="o-distance-xl">
 592                  <h3 class="c-category-title">Plugins</h3>
 593                  <ul class="o-list-bare">
 594                    
 595                    <li class="o-list-bare__item">
 596                      <a href="/docs/installing_plugins.html" title="Installing plugins" class="u-link-uniform ">Installing plugins</a>
 597                      <!-- <div class="o-distance-m">
 598                        <ul class="o-list-bare c-navigation__subnav">
 599                          <li class="o-list-bare__item">
 600                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 601                          </li>
 602                        </ul>
 603                      </div> -->
 604                    </li>
 605                    
 606                    <li class="o-list-bare__item">
 607                      <a href="/docs/creating_plugins.html" title="Creating plugins" class="u-link-uniform ">Creating plugins</a>
 608                      <!-- <div class="o-distance-m">
 609                        <ul class="o-list-bare c-navigation__subnav">
 610                          <li class="o-list-bare__item">
 611                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 612                          </li>
 613                        </ul>
 614                      </div> -->
 615                    </li>
 616                    
 617                    <li class="o-list-bare__item">
 618                      <a href="/docs/plugin_reference.html" title="Plugin APIs" class="u-link-uniform is-active">Plugin APIs</a>
 619                      <!-- <div class="o-distance-m">
 620                        <ul class="o-list-bare c-navigation__subnav">
 621                          <li class="o-list-bare__item">
 622                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 623                          </li>
 624                        </ul>
 625                      </div> -->
 626                    </li>
 627                    
 628                  </ul>
 629                </div>
 630              
 631                <div class="o-distance-xl">
 632                  <h3 class="c-category-title">Cockpit Guides</h3>
 633                  <ul class="o-list-bare">
 634                    
 635                    <li class="o-list-bare__item">
 636                      <a href="/docs/cockpit_introduction.html" title="Introduction" class="u-link-uniform ">Introduction</a>
 637                      <!-- <div class="o-distance-m">
 638                        <ul class="o-list-bare c-navigation__subnav">
 639                          <li class="o-list-bare__item">
 640                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 641                          </li>
 642                        </ul>
 643                      </div> -->
 644                    </li>
 645                    
 646                    <li class="o-list-bare__item">
 647                      <a href="/docs/cockpit_dashboard.html" title="Using the Dashboard" class="u-link-uniform ">Using the Dashboard</a>
 648                      <!-- <div class="o-distance-m">
 649                        <ul class="o-list-bare c-navigation__subnav">
 650                          <li class="o-list-bare__item">
 651                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 652                          </li>
 653                        </ul>
 654                      </div> -->
 655                    </li>
 656                    
 657                    <li class="o-list-bare__item">
 658                      <a href="/docs/cockpit_deployment.html" title="Deployment" class="u-link-uniform ">Deployment</a>
 659                      <!-- <div class="o-distance-m">
 660                        <ul class="o-list-bare c-navigation__subnav">
 661                          <li class="o-list-bare__item">
 662                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 663                          </li>
 664                        </ul>
 665                      </div> -->
 666                    </li>
 667                    
 668                    <li class="o-list-bare__item">
 669                      <a href="/docs/cockpit_explorer.html" title="Explorer View" class="u-link-uniform ">Explorer View</a>
 670                      <!-- <div class="o-distance-m">
 671                        <ul class="o-list-bare c-navigation__subnav">
 672                          <li class="o-list-bare__item">
 673                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 674                          </li>
 675                        </ul>
 676                      </div> -->
 677                    </li>
 678                    
 679                    <li class="o-list-bare__item">
 680                      <a href="/docs/cockpit_editor.html" title="Code Editor" class="u-link-uniform ">Code Editor</a>
 681                      <!-- <div class="o-distance-m">
 682                        <ul class="o-list-bare c-navigation__subnav">
 683                          <li class="o-list-bare__item">
 684                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 685                          </li>
 686                        </ul>
 687                      </div> -->
 688                    </li>
 689                    
 690                    <li class="o-list-bare__item">
 691                      <a href="/docs/cockpit_debugger.html" title="Using the Debugger" class="u-link-uniform ">Using the Debugger</a>
 692                      <!-- <div class="o-distance-m">
 693                        <ul class="o-list-bare c-navigation__subnav">
 694                          <li class="o-list-bare__item">
 695                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 696                          </li>
 697                        </ul>
 698                      </div> -->
 699                    </li>
 700                    
 701                  </ul>
 702                </div>
 703              
 704                <div class="o-distance-xl">
 705                  <h3 class="c-category-title">Reference</h3>
 706                  <ul class="o-list-bare">
 707                    
 708                    <li class="o-list-bare__item">
 709                      <a href="/docs/embark_commands.html" title="CLI Commands" class="u-link-uniform ">CLI Commands</a>
 710                      <!-- <div class="o-distance-m">
 711                        <ul class="o-list-bare c-navigation__subnav">
 712                          <li class="o-list-bare__item">
 713                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 714                          </li>
 715                        </ul>
 716                      </div> -->
 717                    </li>
 718                    
 719                  </ul>
 720                </div>
 721              
 722                <div class="o-distance-xl">
 723                  <h3 class="c-category-title">Miscellaneous</h3>
 724                  <ul class="o-list-bare">
 725                    
 726                    <li class="o-list-bare__item">
 727                      <a href="/docs/migrating_from_3.x.html" title="Migrating from Embark 3.x" class="u-link-uniform ">Migrating from Embark 3.x</a>
 728                      <!-- <div class="o-distance-m">
 729                        <ul class="o-list-bare c-navigation__subnav">
 730                          <li class="o-list-bare__item">
 731                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 732                          </li>
 733                        </ul>
 734                      </div> -->
 735                    </li>
 736                    
 737                    <li class="o-list-bare__item">
 738                      <a href="/docs/troubleshooting.html" title="Troubleshooting" class="u-link-uniform ">Troubleshooting</a>
 739                      <!-- <div class="o-distance-m">
 740                        <ul class="o-list-bare c-navigation__subnav">
 741                          <li class="o-list-bare__item">
 742                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 743                          </li>
 744                        </ul>
 745                      </div> -->
 746                    </li>
 747                    
 748                    <li class="o-list-bare__item">
 749                      <a href="/docs/contributing.html" title="Contributing" class="u-link-uniform ">Contributing</a>
 750                      <!-- <div class="o-distance-m">
 751                        <ul class="o-list-bare c-navigation__subnav">
 752                          <li class="o-list-bare__item">
 753                            <a href="#" title="What is Embark?" class="u-link-uniform">What is Embark?</a>
 754                          </li>
 755                        </ul>
 756                      </div> -->
 757                    </li>
 758                    
 759                  </ul>
 760                </div>
 761              
 762            </nav>
 763          </div>
 764        </div>
 765        <div class="o-guided-content__content">
 766          <p class="c-meta">Last updated: January 19th 2020
 767            (<a href="https://github.com/embarklabs/embark/edit/master/site/source/docs/plugin_reference.md" target="_blank">
 768              Improve this guide <svg class="c-icon c-icon--xs"><use xlink:href="/../../assets/icons/symbols.svg#icon-pen-write-paper"></use></svg>
 769            </a>)
 770          </p>
 771          <div class="o-standard-page">
 772            <h1>Plugin APIs</h1>
 773            <p>This reference covers all APIs exposed by the <code>embark</code> object passed to every custom created plugin. Make sure to read the section on <a href="/docs/creating_plugins.html">creating a plugin</a> first.</p>
 774  <h2 id="pluginConfig"><a href="#pluginConfig" class="headerlink" title=".pluginConfig"></a>.pluginConfig</h2><p><code>pluginConfig</code> is an object that contains the configuration for your plugin specified in the project’s <code>embark.json</code>. For example, if a plugin configuration like the following:</p>
 775  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">&quot;plugins&quot;: &#123;</span><br><span class="line">  &quot;embark-babel&quot;: &#123; </span><br><span class="line">    &quot;files&quot;: [&quot;**&#x2F;*.js&quot;, &quot;!**&#x2F;jquery.min.js&quot;],</span><br><span class="line">    &quot;presets&quot;: [&quot;es2015&quot;, &quot;react&quot;]</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 776  
 777  <p><code>embark.pluginConfig</code> will contain </p>
 778  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">&#123; </span><br><span class="line">  &quot;files&quot;: [&quot;**&#x2F;*.js&quot;, &quot;!**&#x2F;jquery.min.js&quot;],</span><br><span class="line">  &quot;presets&quot;: [&quot;es2015&quot;, &quot;react&quot;]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 779  
 780  <p>and can be used by your plugin as needed.</p>
 781  <h2 id="registerPipeline-matchingFiles-callback-options"><a href="#registerPipeline-matchingFiles-callback-options" class="headerlink" title=".registerPipeline(matchingFiles, callback(options))"></a>.registerPipeline(matchingFiles, callback(options))</h2><p>This call will return the content of the current asset file so the plugin can transform it in some way. Typically this is used to implement pipeline plugins such as Babel, JSX, sass to css, etc.</p>
 782  <p><code>matchingFiles</code> is an array of matching files the plugin should be called with for e.g <code>[&#39;**/*.js&#39;, &#39;!vendor/jquery.js&#39;]</code> matches all JavaScript files except <code>vendor/jquery.js</code>.</p>
 783  <p>Available optinos:</p>
 784  <ul>
 785  <li><code>targetFile</code> - filename to be generated</li>
 786  <li><code>source</code> - content of the file</li>
 787  </ul>
 788  <p>Returns <code>string</code></p>
 789  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">var babel &#x3D; require(&quot;babel-core&quot;);</span><br><span class="line">require(&quot;babel-preset-react&quot;);</span><br><span class="line"></span><br><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.registerPipeline([&quot;**&#x2F;*.js&quot;, &quot;**&#x2F;*.jsx&quot;], (options) &#x3D;&gt; &#123;</span><br><span class="line">    return babel.transform(options.source, &#123;</span><br><span class="line">      minified: true,</span><br><span class="line">      presets: [&#39;react&#39;]</span><br><span class="line">    &#125;).code;</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 790  
 791  <h2 id="registerContractConfiguration-contractsConfig"><a href="#registerContractConfiguration-contractsConfig" class="headerlink" title=".registerContractConfiguration(contractsConfig)"></a>.registerContractConfiguration(contractsConfig)</h2><p>This call is used to specify a configure of one or more contracts in one or several environments. This is useful for specifying the different configurations a contract might have depending on the enviroment. For instance in the code bellow, the <code>DGDToken</code> contract code will redeployed with the arguments <code>100</code> in any environment, except for the livenet since it’s already deployed there at a particular address.</p>
 792  <p>Typically this call is used in combination with <code>embark.addContractFile</code></p>
 793  <p><code>contractsConfig</code> is an object in the same structure as the one found in the contracts configuration at <code>config/contracts.json</code>. The users own configuration will be merged with the one specified in the plugins.</p>
 794  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.registerContractConfiguration(&#123;</span><br><span class="line">    &quot;default&quot;: &#123;</span><br><span class="line">      &quot;deploy&quot;: &#123;</span><br><span class="line">        &quot;DGDToken&quot;: &#123;</span><br><span class="line">          &quot;args&quot;: [</span><br><span class="line">            100</span><br><span class="line">          ]</span><br><span class="line">        &#125;</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;,</span><br><span class="line">    &quot;livenet&quot;: &#123;</span><br><span class="line">      &quot;deploy&quot;: &#123;</span><br><span class="line">        &quot;DGDToken&quot;: &#123;</span><br><span class="line">          &quot;address&quot;: &quot;0xe0b7927c4af23765cb51314a0e0521a9645f0e2a&quot;</span><br><span class="line">        &#125;</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 795  
 796  <h2 id="addContractFile-file"><a href="#addContractFile-file" class="headerlink" title=".addContractFile(file)"></a>.addContractFile(file)</h2><p>Typically this call is used in combination with <code>embark.registerContractConfiguration</code>. If you want to make the contract available but not automatically deployed without the user specifying so you can use <code>registerContractConfiguration</code> to set the contract config to <code>deploy: false</code>, this is particularly useful for when the user is meant to extend the contract being given (e.g <code>contract MyToken is StandardToken</code>)</p>
 797  <p><code>file</code> is the contract file to add to embark, the path should relative to the plugin.</p>
 798  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.addContractFile(&quot;.&#x2F;DGDToken.sol&quot;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 799  
 800  <h2 id="addFileToPipeline-file-options"><a href="#addFileToPipeline-file-options" class="headerlink" title=".addFileToPipeline(file, options)"></a>.addFileToPipeline(file, options)</h2><p>This call is used to add a file to the pipeline so it’s included with the dapp on the client side.</p>
 801  <p><code>file</code> is the file to add to the pipeline, the path should relative to the plugin.</p>
 802  <p><code>intendedPath</code> is the intended path outside of the plugin</p>
 803  <p>Available options:</p>
 804  <ul>
 805  <li><code>skipPipeline</code> - If <code>true</code> it will not apply transformations to the file. For<br>example if you have a babel plugin to transform es6 code or a minifier plugin, setting this to<br>true will not apply the plugin on this file.</li>
 806  </ul>
 807  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.addFileToPipeline(&quot;.&#x2F;jquery.js&quot;, &#123;skipPipeline: true&#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 808  
 809  <h2 id="registerBeforeDeploy-callback-options-callback"><a href="#registerBeforeDeploy-callback-options-callback" class="headerlink" title=".registerBeforeDeploy(callback(options), [callback])"></a>.registerBeforeDeploy(callback(options), [callback])</h2><p>This call can be used to add handler to process contract code after it was generated, but immediately before it is going to be deployed.<br>It is useful to replace placeholders with dynamic values.</p>
 810  <p>Available options:</p>
 811  <ul>
 812  <li><code>embarkDeploy</code> - instance of Deploy class. Has following fields: web3, contractsManager, logger, env, chainConfig, gasLimit.</li>
 813  <li><code>pluginConfig</code> - plugin configuration object from embark.json</li>
 814  <li><code>deploymentAccount</code> - address of account which will be used to deploy this contract</li>
 815  <li><code>contract</code> - contract object.</li>
 816  <li><code>callback</code> - callback function that handler must call with result object as the only argument. Result object must have field contractCode with (un)modified code from contract.code</li>
 817  </ul>
 818  <p>You can use the callback argument instead of the callback option if you prefer. It needs the same result object.</p>
 819  <p>expected return: ignored</p>
 820  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.registerBeforeDeploy(function(options) &#123;</span><br><span class="line">    var code &#x3D; options.contract.code.replace(&#x2F;deaddeaddeaddeaddeaddeaddeaddeaddeaddead&#x2F;ig, &#39;c0dec0dec0dec0dec0dec0dec0dec0dec0dec0de&#39;);</span><br><span class="line">    options.callback(&#123; contractCode: code &#125;);</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 821  
 822  <h2 id="registerClientWeb3Provider-callback-options"><a href="#registerClientWeb3Provider-callback-options" class="headerlink" title=".registerClientWeb3Provider(callback(options))"></a>.registerClientWeb3Provider(callback(options))</h2><p>This call can be used to override the default web3 object generation in the dapp. it’s useful if you want to add a plugin to interact with services like <a href="http://infura.io" target="_blank" rel="noopener">http://infura.io</a> or if you want to use your own web3.js library extension.</p>
 823  <p>options available:</p>
 824  <ul>
 825  <li>rpcHost - configured rpc Host to connect to</li>
 826  <li>rpcPort - configured rpc Port to connect to</li>
 827  <li>blockchainConfig - object containing the full blockchain configuration for the current environment</li>
 828  </ul>
 829  <p>expected return: <code>string</code></p>
 830  <p>example:</p>
 831  <pre><code class="javascript">module.exports = function(embark) {
 832    embark.registerClientWeb3Provider(function(options) {
 833      return "web3 = new Web3(new Web3.providers.HttpProvider('http://" + options.rpcHost + ":" + options.rpcPort + "'));";
 834    });
 835  }
 836  </code></pre>
 837  
 838  
 839  <h2 id="registerContractsGeneration-callback-options"><a href="#registerContractsGeneration-callback-options" class="headerlink" title=".registerContractsGeneration(callback(options))"></a>.registerContractsGeneration(callback(options))</h2><p>By default Embark will use EmbarkJS to declare contracts in the Dapp. You can override that and use your own client side library.</p>
 840  <p>Available options:</p>
 841  <ul>
 842  <li>contracts - Hash of objects containing all the deployed contracts. (key: contractName, value: contract object)<ul>
 843  <li>abiDefinition</li>
 844  <li>code</li>
 845  <li>deployedAddress</li>
 846  <li>gasEstimates</li>
 847  <li>gas</li>
 848  <li>gasPrice</li>
 849  <li>runtimeByteCode</li>
 850  </ul>
 851  </li>
 852  </ul>
 853  <p>Returns <code>string</code></p>
 854  <p> The generated string will be used to create the contract objects in the Embark console and will be generated in <code>embarkArtifacts</code> so that the Dapp can use them.</p>
 855  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">module.exports &#x3D; (embark) &#x3D;&gt; &#123;</span><br><span class="line">  embark.registerContractsGeneration((options) &#x3D;&gt; &#123;</span><br><span class="line">    const contractGenerations &#x3D; [];</span><br><span class="line">    Object.keys(options.contracts).map(className &#x3D;&gt; &#123;</span><br><span class="line">      const contract &#x3D; options.contracts[className];</span><br><span class="line">      const abi &#x3D; JSON.stringify(contract.abiDefinition);</span><br><span class="line"></span><br><span class="line">      contractGenerations.push(&#96;$&#123;className&#125; &#x3D; new web3.eth.Contract($&#123;abi&#125;, &#39;$&#123;contract.deployedAddress&#125;&#39;);</span><br><span class="line">      module.exports &#x3D; $&#123;className&#125;;&#96;);</span><br><span class="line">    &#125;);</span><br><span class="line">    return contractGenerations.join(&#39;\n&#39;);</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
 856  
 857  <h2 id="registerConsoleCommand-options"><a href="#registerConsoleCommand-options" class="headerlink" title=".registerConsoleCommand(options)"></a>.registerConsoleCommand(options)</h2><p>This call is used to extend the console with custom commands.</p>
 858  <p>The function takes an <code>object</code> with the following options:</p>
 859  <ul>
 860  <li><code>description</code>: Description of the command (used by the help command)</li>
 861  <li><code>matches</code>: Either an <code>array</code> of strings corresponding to exact matches for the command or a <code>function</code> where the only parameter in the command<ul>
 862  <li>The <code>function</code> must return a <code>boolean</code>. True if it matches, <code>false</code> if not.</li>
 863  </ul>
 864  </li>
 865  <li><code>usage</code>: Usage of the command that will be outputed by the help command<ul>
 866  <li>Adding <code>usage</code> is optional in the case where <code>matches</code> is an <code>array</code></li>
 867  </ul>
 868  </li>
 869  <li><code>process</code>: <code>function</code> that will be executed to process the command. The <code>function</code> receives two parameters:<ul>
 870  <li><code>command</code>: The <code>string</code> command that the user entered</li>
 871  <li><code>callback</code>: Callback <code>function</code> to be called at the end of the process<ul>
 872  <li>This callback takes two parameters. The first an error, the second the output of the command. The output will be displayed in the console</li>
 873  </ul>
 874  </li>
 875  </ul>
 876  </li>
 877  </ul>
 878  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.registerConsoleCommand(&#123;</span><br><span class="line">    description: &quot;Salutes the world&quot;,</span><br><span class="line">    matches: [&quot;hello&quot;, &quot;hellowWorld&quot;],</span><br><span class="line">    &#x2F;&#x2F; OR a function for more complex cases</span><br><span class="line">    matches: (cmd) &#x3D;&gt; &#123;</span><br><span class="line">      const [commandName, name] &#x3D; cmd.split(&#39; &#39;); &#x2F;&#x2F; You can use &#96;split&#96; for commands that receive parameters</span><br><span class="line">      return commandName &#x3D;&#x3D;&#x3D; &#39;hello&#39; || commandName &#x3D;&#x3D;&#x3D; &#39;hellowWorld&#39;; </span><br><span class="line">    &#125;,</span><br><span class="line">    usage: &quot;hello &lt;name&gt; or helloWorld &lt;name&gt;&quot;,</span><br><span class="line">    process: (cmd, callback) &#x3D;&gt; &#123;</span><br><span class="line">      const [commandName, name] &#x3D; cmd.split(&#39; &#39;);</span><br><span class="line">      name &#x3D; name || &quot;noName&quot;; &#x2F;&#x2F; Default to &quot;noName&quot; when nothing is specified</span><br><span class="line">      callback(null, &#96;Hello $&#123;name&#125;&#96;); &#x2F;&#x2F; Call back with the message. This will be outputed in the console</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 879  
 880  <h2 id="registerCompiler-extension-callback-contractFiles-doneCallback"><a href="#registerCompiler-extension-callback-contractFiles-doneCallback" class="headerlink" title=".registerCompiler(extension, callback(contractFiles, doneCallback))"></a>.registerCompiler(extension, callback(contractFiles, doneCallback))</h2><p>Registers a new compiler for a specific contract extension.</p>
 881  <p>Arguments:</p>
 882  <ul>
 883  <li><strong>extension</strong>: The file extension (e.g: <code>.sol</code>)</li>
 884  <li><strong>callback</strong>: Function called by Embark with the contract files that the plugin should process<ul>
 885  <li><strong>contractFiles</strong>: Array of files that need to be compiled</li>
 886  <li><strong>doneCallback(error, result)</strong>: The final callback to call once every file is compiled or when there is an error<ul>
 887  <li><strong>error</strong>: Error string or object when something goes wrong</li>
 888  <li><strong>result</strong>: An object containing the compiled contracts result (key: contractName, value: contract object) or, <code>false</code> if your plugin is not compatible</li>
 889  <li><strong>code</strong> - [required] contract bytecode (string)      </li>
 890  <li><strong>abiDefinition</strong> - [required] contract abi (array of objects)<ul>
 891  <li>e.g <code>[{&quot;constant&quot;:true,&quot;inputs&quot;:[],&quot;name&quot;:&quot;storedData&quot;,&quot;outputs&quot;:[{&quot;name&quot;:&quot;&quot;,&quot;type&quot;:&quot;uint256&quot;}],&quot;payable&quot;:false,&quot;type&quot;:&quot;function&quot;}, etc...</code></li>
 892  </ul>
 893  </li>
 894  <li><strong>runtimeBytecode</strong> - [optional] contract runtimeBytecode (string)</li>
 895  <li><strong>gasEstimates</strong> - [optional] gas estimates for constructor and methods (hash)<ul>
 896  <li>e.g <code>{&quot;creation&quot;:[20131,38200],&quot;external&quot;:{&quot;get()&quot;:269,&quot;set(uint256)&quot;:20163,&quot;storedData()&quot;:224},&quot;internal&quot;:{}}</code></li>
 897  </ul>
 898  </li>
 899  <li><strong>functionHashes</strong> - [optional] object with methods and their corresponding hash identifier (hash)<ul>
 900  <li>e.g <code>{&quot;get()&quot;:&quot;6d4ce63c&quot;,&quot;set(uint256)&quot;:&quot;60fe47b1&quot;,&quot;storedData()&quot;:&quot;2a1afcd9&quot;}</code></li>
 901  </ul>
 902  </li>
 903  </ul>
 904  </li>
 905  </ul>
 906  </li>
 907  </ul>
 908  <p>Below a possible implementation of a solcjs plugin.<br>Note that the plugin checks the version and returns <code>false</code> as the result if it is not compatible:</p>
 909  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">const solc &#x3D; require(&#39;solc&#39;);</span><br><span class="line">const semver &#x3D; require(&#39;semver&#39;);</span><br><span class="line"></span><br><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.registerCompiler(&quot;.sol&quot;, function(contractFiles, cb) &#123;</span><br><span class="line">    const wantedVersion &#x3D; embark.config.embarkConfig.versions.solc;</span><br><span class="line">    if (semver.gt(wantedVersion, &#39;0.5.0&#39;)) &#123;</span><br><span class="line">      &#x2F;&#x2F; We do not support greater than solidity version 0.5.0</span><br><span class="line">      &#x2F;&#x2F; This let&#39;s Embark know that we are not compatible, that way Embark will fallback to another compiler</span><br><span class="line">      return cb(null, false);</span><br><span class="line">    &#125;</span><br><span class="line">  </span><br><span class="line">    &#x2F;&#x2F; prepare input for solc</span><br><span class="line">    var input &#x3D; &#123;&#125;;</span><br><span class="line">    for (var i &#x3D; 0; i &lt; contractFiles.length; i++) &#123;</span><br><span class="line">      var filename &#x3D; contractFiles[i].filename.replace(&#39;app&#x2F;contracts&#x2F;&#39;,&#39;&#39;);</span><br><span class="line">      input[filename] &#x3D; contractFiles[i].content.toString();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    &#x2F;&#x2F; compile files</span><br><span class="line">    var output &#x3D; solc.compile(&#123;sources: input&#125;, 1);</span><br><span class="line"></span><br><span class="line">    &#x2F;&#x2F; generate the compileObject expected by embark</span><br><span class="line">    var json &#x3D; output.contracts;</span><br><span class="line">    var compiled_object &#x3D; &#123;&#125;;</span><br><span class="line">    for (var className in json) &#123;</span><br><span class="line">      var contract &#x3D; json[className];</span><br><span class="line"></span><br><span class="line">      compiled_object[className] &#x3D; &#123;&#125;;</span><br><span class="line">      compiled_object[className].code            &#x3D; contract.bytecode;</span><br><span class="line">      compiled_object[className].runtimeBytecode &#x3D; contract.runtimeBytecode;</span><br><span class="line">      compiled_object[className].gasEstimates    &#x3D; contract.gasEstimates;</span><br><span class="line">      compiled_object[className].functionHashes  &#x3D; contract.functionHashes;</span><br><span class="line">      compiled_object[className].abiDefinition   &#x3D; JSON.parse(contract.interface);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    cb(null, compiled_object);</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 910  
 911  <h2 id="logger"><a href="#logger" class="headerlink" title=".logger"></a>.logger</h2><p>To print messages to the embark log is it better to use <code>embark.logger</code> instead of <code>console</code>.</p>
 912  <p>e.g <code>embark.logger.info(&quot;hello&quot;)</code></p>
 913  <h2 id="events-on-eventName-callback-args"><a href="#events-on-eventName-callback-args" class="headerlink" title=".events.on(eventName, callback(*args))"></a>.events.on(eventName, callback(*args))</h2><p>This call is used to listen and react to events that happen in Embark such as contract deployment</p>
 914  <ul>
 915  <li>eventName - name of event to listen to<ul>
 916  <li>available events:<ul>
 917  <li><code>contractsDeployed</code> - triggered when contracts have been deployed</li>
 918  <li><code>file-add</code>, <code>file-change</code>, <code>file-remove</code>, <code>file-event</code> - triggered on a file change, args is (filetype, path)</li>
 919  <li><code>outputDone</code> - triggered when dapp is (re)generated</li>
 920  <li><code>firstDeploymentDone</code> - triggered when the dapp is deployed and generated for the first time</li>
 921  <li><code>check:backOnline:serviceName</code> - triggered when the service with <code>serviceName</code> comes back online</li>
 922  <li><code>check:wentOffline:serviceName</code> - triggered when the service with <code>serviceName</code> goes offline</li>
 923  <li><code>log</code> - triggered on a log, args is (logLevel, logMsg)</li>
 924  <li><code>contractsState</code> - list of contracts, their deployment status, address, etc..</li>
 925  <li><code>servicesState</code> - list of services and their state</li>
 926  <li><code>exit</code>: - triggered when embark is terminating</li>
 927  <li><code>deploy:contract:deployed</code>: - triggered when a contract is deployed, the callback will contain the contract object</li>
 928  <li><code>deploy:contract:undeployed</code>: - triggered when a contract was not deployed (typically because there is no need), the callback will contain the contract object</li>
 929  <li><code>deploy:contract:error</code>: - triggered when a contract couldn’t be deployed due to an error, the callback will contain the contract object</li>
 930  <li><code>deploy:contract:receipt</code>: - triggered on a contract deployment (succefull or not), the callback will contain the resulting receipt</li>
 931  <li><code>contractsState</code>: - triggered often, whenever there are changes to contracts, the callback will contain an object containing the contract names, address and state, etc..</li>
 932  <li><code>deploy:beforeAll</code>: - triggered before contract deployment starts</li>
 933  <li><code>contracts:deploy:afterAll</code>: - triggered after contract deployment starts</li>
 934  </ul>
 935  </li>
 936  </ul>
 937  </li>
 938  </ul>
 939  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.events.on(&quot;contractsDeployed&quot;, function() &#123;</span><br><span class="line">    embark.logger.info(&quot;plugin says: your contracts have been deployed&quot;);</span><br><span class="line">  &#125;);</span><br><span class="line">  embark.events.on(&quot;file-change&quot;, function(filetype, path) &#123;</span><br><span class="line">    if (type &#x3D;&#x3D;&#x3D; &#39;contract&#39;) &#123;</span><br><span class="line">      embark.logger.info(&quot;plugin says: you just changed the contract at &quot; + path);</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 940  
 941  <h3 id="events-request-requestName-callback-args"><a href="#events-request-requestName-callback-args" class="headerlink" title=".events.request(requestName, callback(*args))"></a>.events.request(requestName, callback(*args))</h3><p>This call is used to request a certain resource from Embark</p>
 942  <ul>
 943  <li>requestName - name of request to listen to<ul>
 944  <li>available requests:<ul>
 945  <li>(<code>deploy:contract</code>, contractObj) - deploys a particular contract through embark</li>
 946  <li>(<code>runcode:eval</code>, code) - runs js code in the Embark engine.</li>
 947  <li>(<code>runcode:register</code>, cmdName, cmdObj) - ‘registers’ a variable cmdName to correspond to a js object cmdObj (note: this should be done thourgh an emit);</li>
 948  <li>(<code>contracts:list</code>) - returns a list a callback containing (err, contractList) containing a collection of available contracts</li>
 949  <li>(<code>compiler:contracts</code>, contractFiles) - requests embark to compile a list of files, will return a compiled object in the callback</li>
 950  <li>(<code>services:register</code>, serviceName, checkCallback) - requests embark to register a service, it will execute checkCallback every 5 seconds, the callback should return an object containing the service name and status (See embark.registerServiceCheck)</li>
 951  <li>(<code>console:command</code>, cmd) - execute a command in the console</li>
 952  </ul>
 953  </li>
 954  </ul>
 955  </li>
 956  </ul>
 957  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.events.request(&quot;code&quot;, function(code) &#123;</span><br><span class="line">    &#x2F;&#x2F; Do something with the code</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 958  
 959  <h2 id="registerServiceCheck-serviceName-callback-name-status-time"><a href="#registerServiceCheck-serviceName-callback-name-status-time" class="headerlink" title=".registerServiceCheck(serviceName, callback({name, status}), time)"></a>.registerServiceCheck(serviceName, callback({name, status}), time)</h2><p>This call is used to register a service in embark so it’s periodically checked.<br>It will be displayed in the Embark Dashboard, and will also trigger events such as <code>check:backOnline:yourServiceName</code> and <code>check:backOffline:yourServiceName</code></p>
 960  <ul>
 961  <li>serviceName - name of service (string)</li>
 962  <li>callback:<ul>
 963  <li><code>name</code> - name/text to display (string)</li>
 964  <li><code>status</code> - status of the service (string, <code>on</code> or <code>off</code> or <code>warn</code>)</li>
 965  </ul>
 966  </li>
 967  <li>time (optional) - ms interval to call the callback (default: 5000 ms)</li>
 968  </ul>
 969  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.registerServiceCheck(&quot;MyServer&quot;, function(cb) &#123;</span><br><span class="line">    if (myServiceOnline()) &#123;</span><br><span class="line">      return cb(&#123;name: &quot;MyServer Online&quot;, status: &quot;on&quot;&#125;);</span><br><span class="line">    &#125; else &#123;</span><br><span class="line">      return cb(&#123;name: &quot;MyServer Offline&quot;, status: &quot;off&quot;&#125;);</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 970  
 971  <h2 id="registerUploadCommand-cmdName-callback"><a href="#registerUploadCommand-cmdName-callback" class="headerlink" title=".registerUploadCommand(cmdName, callback)"></a>.registerUploadCommand(cmdName, callback)</h2><p>This call is used to add a new cmd to <code>embark upload</code> to upload the dapp to a new storage service. In the example, <code>run</code> doesn’t exist. You need to import a library that runs shell commands like <a href="https://www.npmjs.com/package/shelljs" target="_blank" rel="noopener">shelljs</a></p>
 972  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.registerUploadCommand(&quot;ipfs&quot;, function() &#123;</span><br><span class="line">    run(&quot;ipfs add -r dist&#x2F;&quot;);</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 973  
 974  <h2 id="addCodeToEmbarkJS-code"><a href="#addCodeToEmbarkJS-code" class="headerlink" title=".addCodeToEmbarkJS(code)"></a>.addCodeToEmbarkJS(code)</h2><p>This call is used to add code to the embark.js library. It’s typically used to extend it with new functionality, new storage providers, new communication providers, etc..</p>
 975  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.addCodeToEmbarkJS(&quot;alert(&#39;hello world!&#39;)&quot;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 976  
 977  <h2 id="addProviderInit-providerType-code-initCondition-config"><a href="#addProviderInit-providerType-code-initCondition-config" class="headerlink" title=".addProviderInit(providerType, code, initCondition(config))"></a>.addProviderInit(providerType, code, initCondition(config))</h2><p>This call is used to add code to be executed in the initialization under the condition that <code>initCondition</code> returns true. For example this can be used to set the storage provider of EmbarkJS to ipfs if ipfs is enabled as a provider in the config</p>
 978  <ul>
 979  <li>providerType - type of provider (string, “storage” or “communication”)</li>
 980  <li>code - code to add (string)</li>
 981  <li>callback:<ul>
 982  <li>“config” - config of the <code>providerType</code></li>
 983  </ul>
 984  </li>
 985  </ul>
 986  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  let code &#x3D; &quot;\nEmbarkJS.Storage.setProvider(&#39;ipfs&#39;)&quot;;</span><br><span class="line">  embark.addProviderInit(&#39;storage&#39;, code, (storageConfig) &#x3D;&gt; &#123;</span><br><span class="line">    return (storageConfig.provider &#x3D;&#x3D;&#x3D; &#39;ipfs&#39; &amp;&amp; storageConfig.enabled &#x3D;&#x3D;&#x3D; true);</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 987  
 988  <h2 id="registerImportFile-importName-importLocation"><a href="#registerImportFile-importName-importLocation" class="headerlink" title=".registerImportFile(importName, importLocation)"></a>.registerImportFile(importName, importLocation)</h2><p>This call is used so the plugin can make a certain file available as a library to a user</p>
 989  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">var path &#x3D; require(&#39;path&#39;)</span><br><span class="line"></span><br><span class="line">module.exports &#x3D; function(embark) &#123;</span><br><span class="line">  embark.registerImportFile(&quot;my-lib&quot;, path.join(__dirname, &quot;my-lib.js&quot;));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
 990  
 991  <h2 id="registerActionForEvent-eventName-options-cb"><a href="#registerActionForEvent-eventName-options-cb" class="headerlink" title=".registerActionForEvent(eventName, options, cb)"></a>.registerActionForEvent(eventName, options, cb)</h2><p>This lets you register an action for an event. An action, is like a regular command handler event, but enables multiple actions to be registered for the same event and let’s you modify the params before sending them back to the next action or back to Embark.</p>
 992  <p>Here is an example where, before deploying a contract, we check the length of the bytecode to see if it reaches the limit:</p>
 993  <figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">embark.registerActionForEvent(&quot;deployment:contract:beforeDeploy&quot;, async (params, cb) &#x3D;&gt; &#123;</span><br><span class="line">  cosnt contarct &#x3D; params.contract;</span><br><span class="line">  if (!contract.code) &#123;</span><br><span class="line">    return callback();</span><br><span class="line">  &#125;</span><br><span class="line">  </span><br><span class="line">  const code &#x3D; (contract.code.indexOf(&#39;0x&#39;) &#x3D;&#x3D;&#x3D; 0) ? contract.code.substr(2) : contract.code;</span><br><span class="line">  const contractCodeLength &#x3D; Buffer.from(code, &#39;hex&#39;).toString().length;</span><br><span class="line">  if (contractCodeLength &gt; MAX_CONTRACT_BYTECODE_LENGTH) &#123;</span><br><span class="line">    return callback(new Error(&#96;Bytecode for $&#123;contract.className&#125; contract is too large. Not deploying.&#96;));</span><br><span class="line">  &#125;</span><br><span class="line">  callback();</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
 994  
 995  <h3 id="Parameters"><a href="#Parameters" class="headerlink" title="Parameters"></a>Parameters</h3><ul>
 996  <li><code>eventName</code>: String, Name fo the event you want an action to be registered to</li>
 997  <li><code>options</code>: Object, optional, options for the action registration<ul>
 998  <li><code>priority</code>: Integer, priority for when the action should be called. Useful if you want to run before or after other actions. The default priority is 50 and the highest priority is 1 (so high priority runs first)</li>
 999  </ul>
1000  </li>
1001  </ul>
1002  <h3 id="Available-events-for-actions"><a href="#Available-events-for-actions" class="headerlink" title="Available events for actions"></a>Available events for actions</h3><ul>
1003  <li><code>embark:engine:started</code>: Called when the engine just started. No params</li>
1004  <li><code>blockchain:config:modify</code>: Let’s you modify the blockchain configs before starting a blockchain node. Only param is the initial <code>blockchainConfig</code></li>
1005  <li><code>deployment:contract:beforeDeploy</code>: Called before a contract is deployed. Only param is the <code>contract</code></li>
1006  <li><code>deployment:contract:shouldDeploy</code>: Also called before a contract is deployed, but let’s you determine if the contract should be deployed. Two params: <code>contract</code> and <code>shouldDeploy</code>, set <code>shouldDeploy</code> to <code>false</code> to disable its deployment</li>
1007  <li><code>deployment:contract:undeployed</code>: Called after a contract is determined to not deploy. Only param is <code>contract</code></li>
1008  <li><code>deployment:contract:deployed</code>: Called after a contract deployed. Only param is <code>contract</code></li>
1009  <li><code>deployment:deployContracts:beforeAll</code>: Called before any contract is deployed. No params</li>
1010  <li><code>deployment:deployContracts:afterAll</code>: Called after all contracts have deployed. No params</li>
1011  <li><code>tests:contracts:compile:before</code>: Called before the contracts are compiled in the context of the test. Only param is <code>contractFiles</code></li>
1012  <li><code>tests:contracts:compile:after</code>: Called after the contracts are compiled in the context of the test. Only param is <code>compiledContracts</code></li>
1013  <li><code>blockchain:proxy:request</code>: Called before a request from Embark or the Dapp is sent to the blockchain node. You can modify or react to the payload of the request. Params are:<ul>
1014  <li><code>request</code>: an object containing the request payload</li>
1015  <li><code>transport</code>: an object containing the client’s websocket connection to the proxy</li>
1016  <li><code>isWs</code>: a boolean flag indicating if the request was performed using websockets</li>
1017  </ul>
1018  </li>
1019  <li><code>blockchain:proxy:response</code>: Called before the node response is sent back to Embark or the Dapp. You can modify or react to the payload of the response. Params are:<ul>
1020  <li><code>request</code>: an object containing the request payload</li>
1021  <li><code>response</code>: an object containing the response payload</li>
1022  <li><code>transport</code>: an object containing the client’s websocket connection to the proxy</li>
1023  <li><code>isWs</code>: a boolean flag indicating if the request was performed using websockets</li>
1024  </ul>
1025  </li>
1026  </ul>
1027  
1028          </div>
1029          <div class="o-container-medium o-distance-l">
1030            <div class="o-flex o-flex-space-between">
1031    
1032    <div class="o-flex__item">
1033      <a href="/docs/creating_plugins.html" class="c-button c-button--quite" title="Previous article">Previous</a>
1034    </div>
1035    
1036    
1037    <div class="o-flex__item">
1038      <a href="/docs/cockpit_introduction.html" class="c-button c-button--quite" title="Next article">Next</a>
1039    </div>
1040    
1041  </div>
1042  
1043  
1044          </div>
1045        </div>
1046        <div class="o-guided-content__addition">
1047          <h3 class="c-category-title">Contents</h3>
1048          <ol class="o-list-bare"><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#pluginConfig" class="u-link-uniform">.pluginConfig</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#registerPipeline-matchingFiles-callback-options" class="u-link-uniform">.registerPipeline(matchingFiles, callback(options))</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#registerContractConfiguration-contractsConfig" class="u-link-uniform">.registerContractConfiguration(contractsConfig)</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#addContractFile-file" class="u-link-uniform">.addContractFile(file)</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#addFileToPipeline-file-options" class="u-link-uniform">.addFileToPipeline(file, options)</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#registerBeforeDeploy-callback-options-callback" class="u-link-uniform">.registerBeforeDeploy(callback(options), [callback])</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#registerClientWeb3Provider-callback-options" class="u-link-uniform">.registerClientWeb3Provider(callback(options))</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#registerContractsGeneration-callback-options" class="u-link-uniform">.registerContractsGeneration(callback(options))</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#registerConsoleCommand-options" class="u-link-uniform">.registerConsoleCommand(options)</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#registerCompiler-extension-callback-contractFiles-doneCallback" class="u-link-uniform">.registerCompiler(extension, callback(contractFiles, doneCallback))</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#logger" class="u-link-uniform">.logger</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#events-on-eventName-callback-args" class="u-link-uniform">.events.on(eventName, callback(*args))</a><ol class="o-list-bare__child"><li class="o-list-bare__item o-list-bare-level-3 o-ellipsis"><a href="#events-request-requestName-callback-args" class="u-link-uniform">.events.request(requestName, callback(*args))</a></li></ol></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#registerServiceCheck-serviceName-callback-name-status-time" class="u-link-uniform">.registerServiceCheck(serviceName, callback({name, status}), time)</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#registerUploadCommand-cmdName-callback" class="u-link-uniform">.registerUploadCommand(cmdName, callback)</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#addCodeToEmbarkJS-code" class="u-link-uniform">.addCodeToEmbarkJS(code)</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#addProviderInit-providerType-code-initCondition-config" class="u-link-uniform">.addProviderInit(providerType, code, initCondition(config))</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#registerImportFile-importName-importLocation" class="u-link-uniform">.registerImportFile(importName, importLocation)</a></li><li class="o-list-bare__item o-list-bare-level-2 o-ellipsis"><a href="#registerActionForEvent-eventName-options-cb" class="u-link-uniform">.registerActionForEvent(eventName, options, cb)</a><ol class="o-list-bare__child"><li class="o-list-bare__item o-list-bare-level-3 o-ellipsis"><a href="#Parameters" class="u-link-uniform">Parameters</a></li><li class="o-list-bare__item o-list-bare-level-3 o-ellipsis"><a href="#Available-events-for-actions" class="u-link-uniform">Available events for actions</a></li></ol></li></ol>
1049        </div>
1050      </div>
1051    </section>
1052  </main>
1053  
1054  <script src="/js/linkjuice/dist/linkjuice.min.js"></script>
1055  
1056      <footer role="contentinfo" class="c-footer o-distance-xxl">
1057    <div class="o-container">
1058      <div class="c-footer__top">
1059        <p class="c-category-title c-footer__top__title u-text-light">
1060          <a href="/" class="c-logo c-logo--negative" title="Embark">Embark</a>
1061        </p>
1062      </div>
1063      <div class="c-footer__body">
1064        <div class="o-grid">
1065          <div class="o-grid__column--1-1 o-grid__column--medium-1-2 o-grid__column--large-1-5">
1066            <p class="c-category-title u-text-light">Resources</p>
1067            <ul class="o-list-bare">
1068              <li class="o-list-bare__item">
1069                <a href="/docs/quick_start.html" class="u-link-ghost" title="Quick Start">Quick Start</a>
1070              </li>
1071              <li class="o-list-bare__item">
1072                <a href="/docs" class="u-link-ghost" title="Documentation">Documentation</a>
1073              </li>
1074              <li class="o-list-bare__item">
1075                <a href="https://blog.embarklabs.io" target="_blank" rel="noopener" class="u-link-ghost" title="Blog">Blog</a>
1076              </li>
1077              <li class="o-list-bare__item">
1078                <a href="/docs/faq.html" class="u-link-ghost" title="FAQ">FAQ</a>
1079              </li>
1080              <li class="o-list-bare__item">
1081                <a href="/docs/troubleshooting.html" class="u-link-ghost" title="Troubleshooting">Troubleshooting</a>
1082              </li>
1083            </ul>
1084          </div>
1085          <div class="o-grid__column--1-1 o-grid__column--medium-1-2 o-grid__column--large-1-5">
1086            <p class="c-category-title u-text-light">Help</p>
1087            <ul class="o-list-bare">
1088              <li class="o-list-bare__item">
1089                <a href="https://stackoverflow.com/questions/tagged/embark" target="_blank" rel="noopener" class="u-link-ghost" title="Embark Questions">Stack Overflow</a>
1090              </li>
1091              <li class="o-list-bare__item">
1092                <a href="https://gitter.im/embark-framework/Lobby" target="_blank" rel="noopener" class="u-link-ghost" title="Gitter">Gitter</a>
1093              </li>
1094              <li class="o-list-bare__item">
1095                <a href="https://github.com/embarklabs/embark/issues" target="_blank" rel="noopener" class="u-link-ghost" title="Report issues">Report issues</a>
1096              </li>
1097              <li class="o-list-bare__item">
1098                <a href="https://github.com/embarklabs/embark/blob/master/CODE_OF_CONDUCT.md" target="_blank" rel="noopener" class="u-link-ghost" title="Code of Conduct">Code of Conduct</a>
1099              </li>
1100            </ul>
1101          </div>
1102          <div class="o-grid__column--1-1 o-grid__column--medium-1-2 o-grid__column--large-1-5">
1103            <p class="c-category-title u-text-light">Community</p>
1104            <ul class="o-list-bare">
1105              <li class="o-list-bare__item">
1106                <a href="https://github.com/embarklabs" target="_blank" rel="noopener" class="u-link-ghost" title="Github">Github</a>
1107              </li>
1108              <li class="o-list-bare__item">
1109                <a href="https://twitter.com/EmbarkProject" target="_blank" rel="noopener" class="u-link-ghost" title="Twitter">Twitter</a>
1110              </li>
1111              <li class="o-list-bare__item">
1112                <a href="/docs/contributing.html" class="u-link-ghost" title="Contribute">Contribute</a>
1113              </li>
1114              <li class="o-list-bare__item">
1115                <a href="/community/#team" class="u-link-ghost" title="Team">Team</a>
1116              </li>
1117            </ul>
1118          </div>
1119  
1120          <div class="o-grid__column--1-1 o-grid__column--medium-1-2 o-grid__column--large-1-4">
1121            <p class="c-category-title u-text-light">The Status Network</p>
1122            <ul class="o-list-bare two-columns">
1123              <li class="o-list-bare__item"><a class="u-link-ghost" href="https://status.im/" target="_blank">Status</a></li>
1124              <li class="o-list-bare__item"><a class="u-link-ghost" href="https://keycard.tech/" target="_blank">Keycard</a></li>
1125              <li class="o-list-bare__item"><a class="u-link-ghost" href="https://dap.ps/" target="_blank">dap.ps</a></li>
1126              <li class="o-list-bare__item"><a class="u-link-ghost" href="https://teller.exchange/" target="_blank">Teller</a></li>
1127              <li class="o-list-bare__item"><a class="u-link-ghost" href="https://assemble.fund/" target="_blank">Assemble</a></li>
1128              <li class="o-list-bare__item"><a class="u-link-ghost" href="https://subspace.embarklabs.io/" target="_blank">Subspace</a></li>
1129              <li class="o-list-bare__item"><a class="u-link-ghost" href="https://vac.dev/" target="_blank">Vac</a></li>
1130              <li class="o-list-bare__item"><a class="u-link-ghost" href="https://nimbus.team/" target="_blank">Nimbus</a></li>
1131            </ul>
1132          </div>
1133        </div>
1134      </div>
1135      <div class="c-footer__bottom">
1136        <p class="u-text-light">
1137          <a href="https://status.im/privacy-policy.html" title="Privacy Policy" target="_blank" class="u-text-light">Privacy Policy</a>
1138          / © 2019-2020 Embark
1139        </p>
1140      </div>
1141    </div>
1142  </footer>
1143  
1144  
1145  
1146  
1147      <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.4/highlight.min.js"></script>
1148      <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script>
1149      <script>
1150        const EMBARK_DOC_VERSIONS = {
1151          'latest': 'https://framework.embarklabs.io/docs','3.2': 'https://5ca4e0fdb29712000adde37f--embark-site-versions.netlify.com/docs/'
1152        };
1153      </script>
1154  
1155      
1156      <!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
1157      <script>
1158      (function(f, a, t, h, o, m){
1159          a[h]=a[h]||function(){(a[h].q=a[h].q||[]).push(arguments)};
1160          o=f.createElement('script'),
1161          m=f.getElementsByTagName('script')[0];
1162          o.async=1; o.src=t; o.id='fathom-script';
1163          m.parentNode.insertBefore(o,m)
1164      })(document, window, '//fathom.status.im/tracker.js', 'fathom');
1165      fathom('set', 'siteId', 'YDUQQ');
1166      fathom('trackPageview');
1167      </script>
1168      <!-- / Fathom -->
1169      
1170  
1171      <script src="/js/index.js"></script>
1172  
1173      
1174      <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
1175      <script type="text/javascript">
1176        docsearch({
1177          apiKey: '439d8dc2add18007a2f31be4a9c0ed70',
1178          indexName: 'embark',
1179          inputSelector: '#search-input'
1180        });
1181      </script>
1182      
1183    </body>
1184  </html>
1185