dicarlolab / mturkutils

High-throughput web-based human psychophysics
0 stars 4 forks source link

performance.now not supported in Safari #10

Open yamins81 opened 10 years ago

yamins81 commented 10 years ago

@hahong performance.now, which is used in dltk, does not appear to be supported in safari.

Options:

(1) replace it with regular "Date()" subtraction (2) ban the use of safari (3) some other replacement?

hahong commented 10 years ago

I think (2) is the best option. Not just because of the lack of performance.now(). I feel that Safari's requestAnimationFrame is less reliable in terms of timing. In addition, its behavior is slightly different from that of Chrome and Firefox; in Chrome and Firefox, requestAnimationFrame calls the callback drawing function with timestamps generated by performance.now(), which is handy when to precisely measure the time spent in the drawing function ("tdeltas" in queueTrial) with the same performance.now(). In Safari, I wasn't able to get detailed note about requestAnimationFrame and its timestamps, although I haven't spent much time there...

FYI, in my new objectome tasks, I only allow either Chrome or Firefox, on Windows, Mac, and Linux (not e.g. mobile), with screen resolution greater than 1024x600.

hahong commented 10 years ago

After all, I think it's better to focus on Chrome and Firefox only, and throughly test on these when we launch experiments. Adding support for Safari seems a bit too much.

yamins81 commented 10 years ago

I think that's a fair restriction.

In any case the performance object is not supported in safari so from a code cleanliness perspective we should either have something that fills that hole (like what I committed a moment ago) or a clearer error message.... The code that will be used to allow only the given browsers/platforms you mentioned should be separate issue probably.