mirror of
https://github.com/xevidos/codiad.git
synced 2024-11-10 21:26:35 +01:00
19 lines
475 B
JavaScript
19 lines
475 B
JavaScript
|
importScripts('../../lib/diff_match_patch.js');
|
||
|
|
||
|
tasks = {
|
||
|
diff: function(config){
|
||
|
var dmp = new diff_match_patch();
|
||
|
var patchTxt = dmp.patch_toText(dmp.patch_make(config.original, config.changed));
|
||
|
return {
|
||
|
success: true,
|
||
|
result: patchTxt
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
self.addEventListener('message', function(e){
|
||
|
var config = e.data;
|
||
|
var outcome = tasks[config.taskType](config);
|
||
|
self.postMessage(outcome);
|
||
|
}, false);
|