@em1mn/consent-form
To use, include React and React DOM [CDN links](https://reactjs.org/docs/cdn-links.html):
Last updated a year ago by andersem1gan .
Original npm · Tarball · package.json
$ cnpm install @em1mn/consent-form 
SYNC missed versions from official npm registry.

To use, include React and React DOM CDN links:

<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>

Then include lib.${library}.umd.js:

<script crossorigin src="https://unpkg.com/@em1mn/consent-form@0.9.1/dist/lib.${library}.umd.js"></script>

Finally, add a <div> with an appropriate id and load the form (remember to replace ${library}):

<body>
    <div id="fantastic-id"></div>
    <script>
      function initLib() {
        if (!window.${library}) {
          return;
        }
        document.removeEventListener("readystatechange", initLib);
        const container = document.getElementById("fantastic-id");
        const consentIds = [1, 2, 3, 4];
        const graphQLEndpoint = "https://somegraphql.server/graphql";
        const privacyLink = "/privacy";
        const onSubmit = () => {
          //window.location.href = "/thanks";
          console.log("Submitted");
        };
        const onError = (error) => {
          console.error(error);
        };
        const config = {
          container,
          consentIds,
          onSubmit,
          onError,
          //privacyLink,
          graphQLEndpoint,
        };
        ${library}.Gull.contactForm.init(config);

        /*
        Alternatively
        container.addEventListener("onSubmit", onSubmit);
        container.addEventListener("onError", onError);
      */
      }
      document.addEventListener("readystatechange", initLib);
    </script>
</body>

Current Tags

  • 0.9.8                                ...           latest (a year ago)

6 Versions

  • 0.9.8                                ...           a year ago
  • 0.9.7                                ...           a year ago
  • 0.9.6                                ...           a year ago
  • 0.9.5                                ...           a year ago
  • 0.9.4                                ...           a year ago
  • 0.9.3                                ...           a year ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 6
Dependencies (8)
Dev Dependencies (24)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |