PluginKmlOverlay.prototype._create = function(onSuccess, onError, args) { var pluginOptions = args[1]; if (!/^https?:/.test(location.protocol)) { return onError('KmlOverlay is only available on http: or https: protocols.'); } //------------------------------------- // Parse the xml file using WebWorker //------------------------------------- var worker = new InlineWorker(loadKml); worker.onmessage = function(evt) { //console.log('host message', evt.data); worker.terminate(); onSuccess(evt.data); }; worker.onerror = onError; var link = document.createElement('a'); link.href = pluginOptions.url; var url = link.protocol+'//'+link.host+link.pathname+link.search; worker.postMessage({ 'url': url }); };
worker.onmessage = function(evt) { //console.log('host message', evt.data); worker.terminate(); onSuccess(evt.data); };