You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
749 B
24 lines
749 B
const utils = require('./utils') |
|
|
|
console.log('hello worker/////////////////') |
|
|
|
|
|
|
|
worker.onMessage((msg) => { |
|
console.log('[Worker] on appservice message', msg.msg); |
|
let ALWAYS = [] |
|
msg.msg.markes.forEach((item,index)=>{ |
|
let distance = utils.getDistance(msg.msg.coordinate.latitude,msg.msg.coordinate.longitude,item.latitude, item.longitude); |
|
if(distance<Number(msg.msg.radius)){ |
|
ALWAYS.push(index) |
|
} |
|
}); |
|
worker.postMessage({ |
|
msg: ALWAYS, |
|
buffer: utils.str2ab('hello arrayBuffer from worker') |
|
}) |
|
console.log(ALWAYS,'距离符合条件的下标') |
|
// const buffer = msg.buffer |
|
// console.log('[Worker] on appservice buffer length ', buffer) |
|
// console.log('[Worker] on appservice buffer', utils.ab2str(buffer)) |
|
}) |