Sunday, July 25, 2010

Doing form saving with web worker

The Web worker and form field saving, it seems to work. The only problem is that the Web Worker cannot access DOM. I have tried localstorage as well. It cannot retrieve the form field values. This is what I did:

1) User clicks save
2) Increase the queue number
3) Pass the job to the web worker
4) After the webworker done saving with the item, decrease queue and increase completed

In this prototype, however, I hard coded the text variable, that actually should receive the value from a textarea of a form, because I cannot find a solution to pass the value to the web worker. On the other hand, the result was almost there - the queue and completed can increase and decrease based on the web worker. The number of saves clicked and the record number in the database are equals. There is no lags even when the user made quick clicks.

Without the web worker (AJAX only) user can click as many times as he wants, but there will be a lag. Nevertheless, the number of records in database and clicks are equals.

Some how it proved the concept, but it might not necessarily work. Another alternative will be to use the web worker as a queue manager.

numly esn 75682-100725-673958-46


© 2010 All Rights Reserved.

No comments: