Created
September 29, 2016 15:45
-
-
Save Qiki/ec4af17bb9630ce442ef6d8757662d40 to your computer and use it in GitHub Desktop.
note
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//(function(Worker) { | |
// if (!Worker) { | |
// console.log('Web Worker not found.') | |
// return; | |
// } | |
// | |
// var postMessage = Worker.prototype.postMessage; | |
// | |
// Worker.prototype.postMessage = function(data) { | |
// if (data && data.type === 'send' && data.stack && data.stack.length) { | |
// var url = getUrl(data); | |
// if (url.indexOf('/pages/') > -1) { | |
// sendMessageToApp(url); | |
// } | |
// } | |
// postMessage.call(this, data); | |
// } | |
// | |
// function getUrl(data) { | |
// var url = ''; | |
// for (var i = data.stack.length - 1; i >= 0; i--) { | |
// if (data.stack[i] && data.stack[i].method !== 'open') continue; | |
// for (var j = data.stack[i].args.length - 1; j >= 0; j--) { | |
// if (typeof data.stack[i].args[j] === 'string' && data.stack[i].args[j].indexOf('http') > -1) { | |
// url = data.stack[i].args[j]; | |
// } | |
// } | |
// } | |
// return url; | |
// } | |
// | |
// function sendMessageToApp(data) { | |
// try { | |
// window.webkit.messageHandlers.ajaxHandler.postMessage(data); | |
// } catch(err) { | |
// console.log('webview not exist'); | |
// } | |
// } | |
// | |
// })(window.Worker); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment