Recent

Author Topic: Started a new pas2js Package now available on GitHub  (Read 1564 times)

kveroneau

  • Full Member
  • ***
  • Posts: 112
Started a new pas2js Package now available on GitHub
« on: January 01, 2022, 08:35:49 am »
Happy New Years everyone!

Over my vacation time from work, I've been hyper focused on learning the ins and outs of Pas2JS.  I won't get into those details in this post specifically, but will make a new post about some rather interesting findings about using it when compared to using standard FreePascal or Lazarus.  This post is about a new Lazarus package I just pushed up to GitHub for everyone to enjoy.  I gave it a very lenient license of MIT, so you should be-able to easily use the units in your own pas2JS projects if you'd like without needing to worry about anything.

At first glance, these units might not be immediately useful for a majority of projects, as they have a very niche use-case.  However, I believe that for someone who might be curious on how to integrate outside JavaScript functions and classes(including jQuery libraries) with pas2JS, reading this source could prove invaluable in better understanding how to create units which can easily talk to existing JavaScript libraries.  These units for the most part are extremely easy to read and understand what's going on.

Currently there are 3 working units, which have been fully tested in a few projects I've been working on over the past week.

The jsterm unit allows one to interact with the jquery.terminal library, and is a nice demonstration to show how a TJQuery helper might be written to extend it.  As many jQuery libraries directly attach to the global jQuery object, this is a good example to show how those libraries can be ported and used in pas2JS effortlessly.

The mxml unit allows one to interact with the MagicXML JavaScript library, which is a stand-alone JavaScript prototype, and this unit shows how these types of JavaScript libraries can be made usable within a Pas2JS program.

And finally there is webvt100 unit.  This is the one I just wrote this evening in just a couple hours of work with ANSI/VT100 documentation on hand.  This creates a fully working VT100 Terminal emulator within your Web browser.  Normally I have this JavaScript library communicate over WebSockets to a Server-side program, but I made this unit fully independent and working entirely within the browser with Pas2JS.  It is the least tested of the bunch, but my current test program really shows promise.  It contains a mode with some basic line editing support using standard VT100 ANSI commands, it even has full mouse support with a Callback event your program can use when the user clicks their mouse in the terminal.

As I mentioned, all these units are pretty niche use-cases, but might be useful for anyone wanting to learn a bit more about JavaScript library integration with Pas2JS.  I do plan on releasing more Pas2JS compatible units in the future, along with some examples/demos on their use.

https://github.com/kveroneau/jslib

 

TinyPortal © 2005-2018