import { useEffectOnce } from "react-use";
import { action } from "@storybook/addon-actions";
export default (function (elm, udt) {
  useEffectOnce(function () {
    var script = document.createElement("script");

    script.onload = function () {
      window.UniversalDataTool.open({
        container: elm,
        udt: udt,
        onSaveTaskOutputItem: function onSaveTaskOutputItem(index, output) {
          action("onSaveTaskOutputItem")(output);
        }
      });
    };

    script.type = "text/javascript";
    script.async = true;
    script.src = "http://localhost:1234/index.js";
    window.document.body.appendChild(script);
  });
});