<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do i import javascript libraries in a strictly widget level? in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-import-javascript-libraries-in-a-strictly/m-p/787946#M3794</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seemed to have worked as the widget now loads. Thank you. Now i've to solve the 'jsPDF is not a constructor' error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jul 2019 18:20:08 GMT</pubDate>
    <dc:creator>Matheus_ViníciusRamos_da_Fonse</dc:creator>
    <dc:date>2019-07-10T18:20:08Z</dc:date>
    <item>
      <title>How do i import javascript libraries in a strictly widget level?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-import-javascript-libraries-in-a-strictly/m-p/787942#M3790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been working on a custom widget for a few weeks now and it has go !tten to the point in which i need to add&amp;nbsp; "print to PDF" functionality. The widget in question generates a report in a modal found within the widget's own HTML file.&lt;BR /&gt;I looke online for solutions and i found this: &lt;A href="https://github.com/MrRio/jsPDF"&gt;jsPDF&lt;/A&gt;. It allows me to save a &amp;lt;div&amp;gt; element of the modal as a PDF to be saved and potentially printed in A4 paper. Problem is: I don't know what to do in order to import into the widget. &lt;BR /&gt;Here's what i've tried:&lt;/P&gt;&lt;UL&gt;&lt;LI style="text-align: justify;"&gt;&lt;STRONG&gt;Tried adding in my define([]) array in this Widget.js&lt;/STRONG&gt; &lt;BR /&gt;I did this once successfully for jquery, so i assumed it would work for this as well. I had loaded in jquery before by doing&lt;DIV style="color: #ebdbb2; background-color: #1d2021; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #a89984;"&gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #b8bb26;"&gt;jimu/loaderplugins/jquery-loader!https://code.jquery.com/jquery-3.4.1.min.js&lt;/SPAN&gt;&lt;SPAN style="color: #a89984;"&gt;'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;So i assumed it'd be as simple as changing the URL in this statement and adding it to the array. Like this:&lt;DIV style="color: #ebdbb2; background-color: #1d2021; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #a89984;"&gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #b8bb26;"&gt;jimu/loaderplugins/jquery-loader!https://unpkg.com/jspdf@latest/dist/jspdf.min.js&lt;/SPAN&gt;&lt;SPAN style="color: #a89984;"&gt;'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;And it was no good. Upon clicking on the widget inside a test application, nothing in the widget itself would load.&lt;/LI&gt;&lt;LI style="text-align: justify;"&gt;&lt;STRONG&gt;Tried copying the code found in the .js file and moving it into Widget.js&lt;BR /&gt;&lt;/STRONG&gt;This is also something i've once successfully in order to import functionality into my widget. I used a jquery library (&lt;A href="https://jquerymodal.com/"&gt;jQuery Modal&lt;/A&gt;) to generate a complete modal to add my report in. But doing the same with jsPDF proved to not work at all.&lt;/LI&gt;&lt;/UL&gt;&lt;P style="text-align: justify;"&gt;So, what can i do to import jsPDF into my widget and widget only? I want to be able to drag and drop the widget folder into other apps in the future for easy modifications.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2019 20:43:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-import-javascript-libraries-in-a-strictly/m-p/787942#M3790</guid>
      <dc:creator>Matheus_ViníciusRamos_da_Fonse</dc:creator>
      <dc:date>2019-07-08T20:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do i import javascript libraries in a strictly widget level?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-import-javascript-libraries-in-a-strictly/m-p/787943#M3791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/web-appbuilder/sample-code/add-a-third-party-library.htm"&gt;https://developers.arcgis.com/web-appbuilder/sample-code/add-a-third-party-library.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL style="color: #4c4c4c; background-color: #ffffff; font-size: 0.9375rem; margin-left: 0.75rem; margin-bottom: 1.5rem;"&gt;&lt;LI style="margin: 0.375rem 0px 0.375rem 1.5rem;"&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;Put the library in the widget or theme folder and add it to your widget or theme dependency array. Use this approach to load an AMD module that only applies to one widget or theme.&lt;/BLOCKQUOTE&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2019 21:44:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-import-javascript-libraries-in-a-strictly/m-p/787943#M3791</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-07-08T21:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do i import javascript libraries in a strictly widget level?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-import-javascript-libraries-in-a-strictly/m-p/787944#M3792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And how exactly do i do that? I've tried adding it to the define array and then the function array. But it still won't work. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2019 17:15:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-import-javascript-libraries-in-a-strictly/m-p/787944#M3792</guid>
      <dc:creator>Matheus_ViníciusRamos_da_Fonse</dc:creator>
      <dc:date>2019-07-10T17:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do i import javascript libraries in a strictly widget level?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-import-javascript-libraries-in-a-strictly/m-p/787945#M3793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Matheus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I am not sure what you are doing wrong then. I just added a third party library to one of my widgets and it worked fine.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="token function"&gt;define&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;'dojo/on'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;'dojo/query'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;'./rcolor'&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;on&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; query&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; rColor&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So I have a file called rcolor.js in my widgets folder, and it just works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:59:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-import-javascript-libraries-in-a-strictly/m-p/787945#M3793</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T08:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do i import javascript libraries in a strictly widget level?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-import-javascript-libraries-in-a-strictly/m-p/787946#M3794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seemed to have worked as the widget now loads. Thank you. Now i've to solve the 'jsPDF is not a constructor' error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2019 18:20:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-import-javascript-libraries-in-a-strictly/m-p/787946#M3794</guid>
      <dc:creator>Matheus_ViníciusRamos_da_Fonse</dc:creator>
      <dc:date>2019-07-10T18:20:08Z</dc:date>
    </item>
  </channel>
</rss>

