I have javascript (.js) file and if I was to call one of the function in that file how should I do that.
I followed following steps
Save the file under the directory src/test/groovy/Custom
Add the directory to class path
Call the function from another groovy file in following way
Code
import Custom
getElementsByClassName("info-links")
But Custom triggers Cannot resolve error
Using intelliJ 13.0.3 as my IDE
What went wrong?
Thanks
Related
I have this project:
but I don't know how to run the generate_js.js in my browser so I can see use console.log inside of the file.
The whole purpose of this project is to run generate_js.js, which is then supposed to generate an icon.js file which contains the svg icons in a particular object format/structure. But what happens when I run generate_js.js is that a folder generate_js is created with all the icons as js files, and each file has an export statement.
I am trying to understand how is all of this working, but I can't. I need to be able to see what's happening on my browser. I need to use console.log to see, but I don't know how to run this project on my browser. There is no index.html file, and when I created one, and linked the project_js.js with a script tag, I keep getting Uncaught ReferenceError: require is not defined error.
How can I run this JavaScript/project on my browser?
Here's the relevant part of package json:
Note: This project is installed as a dependency inside another project, and inside the node_modules, there's a dist folder which contains the icons.js file that I referred to. In it, all the icons are created as objects. I need to change the way the object structure a bit, so I need to understand how are they generated by this generate.js file, but I need to be able to console.log what's happening inside the file.
I have a very particular use case. I want to import a javascript file as a string and inject it into html responses at will in a service worker. I can't see how to do this using parceljs beyond hosting the javascript file somewhere and doing fetch at runtime to load the js file into memory. However, I want to do this at build time. How best to do this?
Note: Ideally the dependencies of javascript file I am importing should be bundled into the string.
Seems to be possible in parcel 2 with
import js from "bundle-text:./b.ts";
console.log(js);
https://v2.parceljs.org/configuration/plugin-configuration/#predefined-(offical)-named-pipelines
I am trying to load insert this library into my ionic project: https://www.npmjs.com/package/ionic-native-transitions.
I ran the command to install the plugin:
ionic plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions
I then inserted the dependency into my code, but it didn't work and reading this issue https://github.com/shprink/ionic-native-transitions/issues/29 I found out I needed to insert the script into my project so...
I have an index.html file located in:
frontend/www/index.html.
I have a js file I need located in:
frontend/node_modules/ionic-native-transitions/dist/ionic-native-transitions.js
I need to use this javascript file inside of my index.html file so I include it into my header:
<script src="../node_modules/ionic-native-transitions/dist/ionic-native-transitions.js"></script>
Inside of my IDE it says the path is valid and I can go to the declaration of this file inside of my IDE.
When I run the application, I get the following output in my console:
Failed to load resource: net::ERR_FILE_NOT_FOUND `file:///android_asset/node_modules/ionic-native-transitions/dist/ionic-native-transitions.js`
I am unsure why this is happening. How could I insert this script into my code then?
Turns out it is a problem with the plugin. I followed this tutorial now and I got it working: http://www.gajotres.net/handling-native-view-animations-with-ionic-framework/. There is no requirement to load any scripts.
I develop one js file and also call one js file from it, but I cannot find file. Error is "file not found". I debug in firebug. File url is not generate well. Code is:
require(['modules/PageDecorator'], function(PageDecorator){
//initializing visual ui
PageDecorator.init();
});
it it, modules is folder and PageDecorator is js file.
url is generated
localhost/js/models/PageDecorator.js
however I need it to be:
localhost/test/js/models/PageDecorator.js
test is my root folder.
I've been looking everywhere for answer to my questions last few hours and couldn't find anything, so i decided to ask.
I followed installation instruction in docs of Dajaxice, got everything setup exacly the same, but unfortunetely my Dajax.core.js file is not getting parsed, so when i click on the javascript link in page html source it still contains template tags. I included the Dajaxice finder in staticfiles_finder(actually i ve got everything setup like in the ins instruction.
I am using django 1.4.1 develop server at the moment for testing and the latest Dajaxice version which is 0.9, is that make any difference ?
Does the order of vars in settings.py matters ?
What are the main reasons the Javascript files are not getting parsed, and actually when they should be parsed ?
Please help me as i really would love to use this app but just can't get it to work.
Thanks in advance.
I advice you to check STATICFILES_FINDERS settings and other settings related to django.contrib.staticfiles app. Dajaxice uses a hook in this app to generate dajaxice.core file.
When you use debug server this static file is generated on the fly, on production environment the file will be generated when you run collectstatic command.
In your case it looks like the dajaxice.core.js file is founded by another static finder or served in any other way.
To check this please run the following command
python manage.py findstatic dajaxice/dajaxice.core.js
The output should look like
Found 'dajaxice/dajaxice.core.js' here:
/tmp/tmp9nzeEd
The filename in tmp dir will be different
Also 2 pitfalls with collect static app:
When you update your ajax.py file to include new dajaxice views you have to run collectstatic again
The file is generated in /tmp/ folder. So if you use -l key to generate links instead of copying files make sure that you will not remove this file by accident.