<?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 to include Javascript file from other Javascript file in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-include-Javascript-file-from-other-Javascript-file/m-p/633039#M51876</link>
    <description>&lt;P&gt;Notes:&lt;BR /&gt;* You need to use define() in the file that is being imported.&lt;BR /&gt;* You need to export the classes and functions from the file that is being imported.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;BR /&gt;&lt;SPAN&gt;app/my_app/appserver/static/utility.js&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;define([
    "underscore",
    "jquery"
], function (
    _,
    $
) {
    class MyUtility {
    }

    return {
        'MyUtility': MyUtility
    }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;app/my_app/appserver/static/main.js&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;require([
    "splunkjs/mvc",
    "underscore",
    "jquery",
    '../app/my_app/utility.js'
], function (
    mvc,
    _,
    $,
    CommonUtility
) {

CommonUtility.MyUtility();

});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Mar 2023 16:55:22 GMT</pubDate>
    <dc:creator>VatsalJagani</dc:creator>
    <dc:date>2023-03-02T16:55:22Z</dc:date>
    <item>
      <title>How to include Javascript file from other Javascript file?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-include-Javascript-file-from-other-Javascript-file/m-p/607016#M49823</link>
      <description>&lt;P&gt;How to include Javascript files from another Javascript file from the local appserver/static folder&lt;/P&gt;
&lt;P&gt;The below code somehow does not work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;require([
    'jquery',
    './myCustomUtils',
    'splunkjs/mvc',
    'underscore',
    'splunkjs/mvc/simplexml/ready!'], 
function($, myCustomUtils, mvc, _){&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 17:00:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-include-Javascript-file-from-other-Javascript-file/m-p/607016#M49823</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2023-03-02T17:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to include Javascript file from other Javascript file</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-include-Javascript-file-from-other-Javascript-file/m-p/607017#M49824</link>
      <description>&lt;P&gt;Answering my own question so I don't have to spend a huge amount of time that I spent today.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to import that file, not from the local folder but instead like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;require([
    'jquery',
    '../app/&amp;lt;my_app&amp;gt;/myCustomUtils',
    'splunkjs/mvc',
    'underscore',
    'splunkjs/mvc/simplexml/ready!'], 
function($, myCustomUtils, mvc, _){&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;-&amp;nbsp;&lt;STRONG&gt;'../app/&amp;lt;my_app&amp;gt;/myCustomUtils'&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps others in the future!!! Upvote if it does!!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 11:09:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-include-Javascript-file-from-other-Javascript-file/m-p/607017#M49824</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-07-26T11:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to include Javascript file from other Javascript file</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-include-Javascript-file-from-other-Javascript-file/m-p/633039#M51876</link>
      <description>&lt;P&gt;Notes:&lt;BR /&gt;* You need to use define() in the file that is being imported.&lt;BR /&gt;* You need to export the classes and functions from the file that is being imported.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;BR /&gt;&lt;SPAN&gt;app/my_app/appserver/static/utility.js&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;define([
    "underscore",
    "jquery"
], function (
    _,
    $
) {
    class MyUtility {
    }

    return {
        'MyUtility': MyUtility
    }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;app/my_app/appserver/static/main.js&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;require([
    "splunkjs/mvc",
    "underscore",
    "jquery",
    '../app/my_app/utility.js'
], function (
    mvc,
    _,
    $,
    CommonUtility
) {

CommonUtility.MyUtility();

});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 16:55:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-include-Javascript-file-from-other-Javascript-file/m-p/633039#M51876</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2023-03-02T16:55:22Z</dc:date>
    </item>
  </channel>
</rss>

