5 Replies Latest reply: Feb 7, 2018 2:48 AM by Marko Zadravec RSS

    Qlik Sense Extensions : bring other js files in

    Marko Zadravec

      Hi,

       

      I am making some Qlik Sense extension, and I would like to use external .js files.

      I was looking to a Qlik Sense documentation page and tutorial, and I don't know what I am doing wrong.

       

      main.js

       

      define( [

              'jquery',

              'qlik',

              './scripts/test',

              'text!./css/myStyle.css'

          ],

          function ( $, qlik, test, cssContent ) {

              'use strict';

               ....

               paint: function ( $element, layout ) {

       

                     test.hello();

                }

           });

       

      test.js

       

           function hello() {

                  console.log(' api test: my');

           }

       

      What I get in console is:

       

      TypeError: Cannot read property 'hello' of undefined

       

      My next question is if/when will my external .js file contain some external library (npm install packages), is it enough to just npm install all necessary packages, or do I need to do something else?