text: import React from 'react';
  import ReactDOM from 'react-dom';
  import _ from 'lodash';
  
  class UrbitApi {
    setAuthTokens(authTokens) {
      this.authTokens = authTokens;
      this.bindPaths = [];
    }
  
    bind(path, method, ship = this.authTokens.ship, appl = "dojo", success, fail) {
      this.bindPaths = _.uniq([...this.bindPaths, path]);
  
      window.subscriptionId = window.urb.subscribe(ship, appl, path,
        (err) => {
          fail(err);
        },
        (event) => {
          success({
            data: event,
            from: {
              ship,
              path
            }
          });
        },
        (err) => {
          fail(err);
        });
    }
  
    soto(data) {
      this.action("dojo", "sole-action",
        {id: this.authTokens.dojoId, dat: data}
      );
    }
  
    action(appl, mark, data) {
      return new Promise((resolve, reject) => {
        window.urb.poke(ship, appl, mark, data,
          (json) => {
            resolve(json);
          },
          (err) => {
            reject(err);
          });
      });
    }
  }
  export let api = new UrbitApi();
  window.api = api;
  