Javascript - How can I pass a jQuery object (table) to a web worker? -
i have html table different columns , rows. table can edited inline user. when user edits table, calculate sums on rows of table.
the function calculates sums in main script , took lot of time making browser unresponsive. solve performance issue, have created web worker in javascript calculate sums on table.
the problem web worker cannot access dom. i'm looking way pass jquery object table web worker.
if try pass jquery object receive error:
uncaught datacloneerror: failed execute 'postmessage' on 'worker': object not cloned.
how can pass table web worker?
thank you
[edit adding further information ]
the sum take long time because table has lot of rows , calculate different sums (total, subtotal,etc). values sum stored in table (so worker need access table perform calculation).
my idea pass dom object worker calculate sums. after calculation, worker return sums main thread in order update values in dom.
in short cannot pass dom element worker. data, typically strings, can passed webworkers not objects. should extract data table, wrap in object, turn object json, send json worker, process , return json main thread.
Comments
Post a Comment