Visual Builder

Get Involved. Join the Conversation.

Topic

    Hong Ling Toh
    Import Javascript Libraries is not working
    Topic posted October 13, 2018 by Hong Ling TohRed Ribbon: 250+ Points, tagged Action Flows, Mobile 
    102 Views, 2 Comments
    Title:
    Import Javascript Libraries is not working
    Content:

    Hi,

    We followed the steps in https://blogs.oracle.com/vbcs/importing-and-using-javascript-libraries-in-your-visual-builder-custom-code

    Therefore, I wrote below for my gl-matrix.js in resources folder:
    -------------------------------------------------------------------------------------------------------
    define(["mobileApps/mytraceapp/resources/gl-matrix"], function(glmatrix) {
      'use strict';
     
      var PageModule = function PageModule() {
      
     PageModule.prototype.createVec3 = function(){
       var myVec3= glmatrix.vec3.create();
       glmatrix.vec3.set(myVec3,0,0,2.0);
       alert("come in");
       return myVec3;
     }; }; 
      return PageModule;
    });

    -------------------------------------------------------------------------------------------------------

    But in the action for button click, I call the createVec3 module, but there was no response when I click the button. It should had an alert("come in"); if it called the function successfully

    Comment

     

    • Rod Magnuson

      If you invoke insight within the double quotes of the define([""] and choose Select URL..., typing gl-matrix and hitting return, it will automatically enter the correct path for you: resources/js/gl-matrix

      I see Uncaught SyntaxError: Unexpected token * in the console when I try to run, loading the library