pas2js configuration help
lazarus / 76-Pas2JS
----------------------------------------------------------------------
mr-highball · 2019-01-16 17:03
I'm just starting to play around with pas2js, but I'm running into
some issues getting things configured properly, here are my steps:
- installed pas2js wtih fpcupdelux
- installed pas2jsdsgn package
- configured pas2js.cfg to point properly to source files
- file -> New -> web browser application (choose default options)
* create initial html page
* maintain html page
- save project to empty directory, and following structure is created
when I attempt to compile, the following error occurs "custom js file
not found: "rtl.js"
I have attempted to add the "small javascript file needed" specified
in this wiki: http://wiki.freepascal.org/pas2js
to the same directory as my project which does allow for compiling
however, when opening in the browser and inspecting
the console window the following errors are present:
"SyntaxError: expected expression, got '<'[Learn More] project1.js:1"
"ReferenceError: rtl is not defined[Learn More]"
inspecting project1.js which is generated by compiling, I see that it
has appened the rtl.js file's contents to
top of the compiled code as such
Code: Pascal [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i rtl.module("System",[],function () { "use strict";
var $mod = this; rtl.createClass($mod,"TObject",null,function () {
this.$init = function () {
when I clear the contents of rtl.js to be an empty script file, then
compile and refresh the project1.html file the following errors occur:
"ReferenceError: rtl is not defined[Learn More] project1.js:1:1"
"ReferenceError: rtl is not defined[Learn More]"
I know I must've missed a step along the process, or am doing
something wrong since it seems others have gotten pas2js to work for
some time now
but any help would be appreciated.
----------------------------------------------------------------------
mr-highball · 2019-01-16 18:50
so digging around I found the rtl script here:
C:\fpcupdeluxe\ccr\pas2js-rtl\compiler\utils\pas2js\dist
I added this location to the pas2js cfg file like this, so my full cfg
looks like this:
Code: Pascal [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i ## Minimal
config file for pas2js compiler## not yet implemented: -d is the same
as #DEFINE# not yet implemented: -u is the same as #UNDEF## Write
always a nice logo ;)-l # Display Hints, Warnings and Notes-vwnh# If
you don't want so much verbosity
use#-vw -Fu$CfgDir/..\..\packages\rtl-Fu$CfgDir/..\..\packages\fcl-
base-Fu$CfgDir/..\..\packages\fcl-db-Fu$CfgDir/..\..\packages\fpcunit-
Fu$CfgDir/..\..\compiler\utils\pas2js\dist #IFDEF nodejs-
Jirtl.js#ENDIF # end.
and my CfgDir is : C:\fpcupdeluxe\ccr\pas2js-rtl\bin\x86_64-win64
These steps now let me compile a web project without compiler errors
and having to drop a local rtl.js file in my project folder, but
loading the web page still shows rtl being undefined... not sure what
else is needed?
----------------------------------------------------------------------
mr-highball · 2019-01-16 19:23
Ok.. so after doing all of the above, and starting a new project, my
output .js file seems to be working appropriately, however still
getting an error in the browser:
Loading failed for the