David McFarlane · @dkmcf
16 followers · 323 posts · Server twit.social

lab.js provides almost ready-to-run downloadable script for its Builder, but it needs some tweaks. Mostly it needs absolute paths replaced with relative paths in several files (included reassigning one obscure variable). It also must run from a server for the ServiceWorkerContainer. Close to working now, still no Preview mode, and exported files do not run.

#labjs

Last updated 1 year ago

David McFarlane · @dkmcf
15 followers · 299 posts · Server twit.social

Added a bunch of script to trace execution of each object in lab.js source code.

#labjs

Last updated 1 year ago

David McFarlane · @dkmcf
14 followers · 280 posts · Server twit.social

Understanding the inner workings of lab.js requires following multiple layers of indirection & inheritance. Perhaps typical for any large project.

#oop #javascript #labjs

Last updated 1 year ago

David McFarlane · @dkmcf
14 followers · 273 posts · Server twit.social

Breakthrough! Turns out I was going about this the wrong way. The "source code" that I had was just precursors to generate the full source code, which then got minified. I managed to find full unminified source, so now I can start my exploration in earnest.

#labjs

Last updated 1 year ago

David McFarlane · @dkmcf
14 followers · 267 posts · Server twit.social

Exploring inner workings of lab.js by running it from readable source code. Learned so far:
- Must use 'type="module"' to load .js files that use "import".
- JavaScript modules will run only from a server, not from local drive.
- Relative references must start with either "/", "./", or "../".
- lab.js relies on several 3rd-party libraries (e.g., , ) which
developers must get for themselves.

#lodash #filesaver #labjs

Last updated 1 year ago

David McFarlane · @dkmcf
14 followers · 257 posts · Server twit.social

@mattewanlaws Thanks for the offer. I have a pretty specific objective: To understand the that underlies the lab.js framework. At my recommendation, we use for conducting psychology research online (alternatives include and ). But I do not like using black boxes. We have the full source code for lab.js, and I want to understand it. But the flow of asynchronous code baffles me, nothing like the synchronous code I have handled for 45 years.

#javascript #labjs #jspsych #PsychoJS

Last updated 1 year ago

David McFarlane · @dkmcf
14 followers · 247 posts · Server twit.social

Revised my lab.js session-counting demo to use "await fetch" when calling the PHP script from JavaScript. This requires setting some components to Tardy mode, a bit untidy but good enough. Now on to revising the PHP script.

#labjs

Last updated 1 year ago

David McFarlane · @dkmcf
12 followers · 189 posts · Server twit.social

Fixing experiment programs written in both lab.js () and .

#labjs #eprime

Last updated 2 years ago