NYUCCL / psiTurk

An open platform for science on Amazon Mechanical Turk.
https://psiturk.org
MIT License
277 stars 140 forks source link

Separate Javascript library for handling interaction with server #13

Closed dmarkant closed 11 years ago

johnmcdonnell commented 11 years ago

I started on this, did you also? I didn't get terribly far.

dmarkant commented 11 years ago

nope haven't started, just adding any issues that weren't already on the list

dmarkant commented 11 years ago

john if you want to commit what you've already done then i will probably have some time to work on this over the weekend.

johnmcdonnell commented 11 years ago

I've commited my stuff into the branch newjslib. I'm using Backbone: http://backbonejs.org/

Do you want me to step you through how this works? Basically backbone provides model objects that automagically sync to the server. So we can have an object that pulls down all the html snippets etc. that we have (eg. for instructions). We should maybe have a directory to store all those snippets, then have a backbone model or collection that requests pages from the server, the server pulls in all those html files and sends them back as JSON.

Likewise I've set up a model for the data. The data model's save function should packages all its data up as JSON and send them to its url.

I'm hoping backbone makes things easier and more intuitive rather than the opposite so let me know if it's confusing.

jbmartin commented 11 years ago

I'm using Backbone and Underscore for the dashboard frontend. At some point, we should have everything point to one stack, as to not repeat ourselves and bloat our codebase.

dmarkant commented 11 years ago

Ok i think i'm getting a hang of backbone...

I thought it might be good to put those functions that people would use in their own task code inside a single object, so they can call "psiTurk.saveData()".

Also I'm guessing that the notifications thing is good when you want to have multiple listeners for a function call. But is there a reason to use them otherwise? I.e., is the API supposed to not refer to the models (which I have it doing right now)?

johnmcdonnell commented 11 years ago

I think what's in newjslib is looking ready to go, Doug does it look good to you? If so I'll merge into dev.

dmarkant commented 11 years ago

I'll just take one more pass through to make sure everything's working, will let you know when it's ready to merge.

dmarkant commented 11 years ago

ok it all looks good to me!

johnmcdonnell commented 11 years ago

Okay I guess I'll close it since it's moved into dev.