Shared Scripts, Data, Stimuli, Files, and Demos

Getfile with timout Demo Run Experiment

Getfile with timout Demo

Jaap Murre

This script does the following:

  • Try to get the file ‘demotext.txt’ in 2 ms (which won’t work)
  • When out of time, return ‘toolate’. Default is to return ‘timeout’.
  • Watch the result in the console (with F12)

When using getfile() it is best to always specify a timeout period, so that it is not possible for your script to ‘hang’ if it cannot load certain stimuli. It is much better to specify a longish timeout and then tell the subject that something is wrong.

No comments yet


By Jaap Murre
2015 04 30

Great script!

If you are a registered user and signed in, you can here copy this script and its stimuli to your own account, where you can edit it and change it in any way you want.

It is absolutely free to register (no credit card info asked!). You can then instantly copy this experiment with one click and edit it, change its accompanying texts, its landing page, stimuli, etc. Invite your colleagues, friends, or students to check out your experiment. There is no limit on how many people can do your experiment, even with a free account.

The catch? There is no catch! Just keep in mind that with a free account, you cannot collect data. For teaching that is usually not a problem. For research, prepaid data collection (unlimited subjects) starts as low as €10.00 for a 10-day period.

var s = getfile("demotext.txt",2,"toolate"); // Will return 'toolate'

console.log("File: ",s);

Data inspection is forthcoming!

In the mean time, authors may download their own data and make it available as an Excel file. Check out the 'Stimuli and Files' tab.

Click on a category to view the stimuli and files

You can download the files shown here by clicking on the file names or image. Note that you cannot link directly to the images, sounds, videos, etc. shown here from other web pages; the link will go stale in about one hour and will no longer work after that.

Related Experiments