Created
July 12, 2013 15:57
-
-
Save ggendre/5985526 to your computer and use it in GitHub Desktop.
a raw (maybe not working) example on how to send back and forth ajax informations to BB10 qml native side
This file contains 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
//fix BB10 ajax calls with a native patch | |
var lib=window.Zepto || window.jQuery; | |
lib.ajax=function(options){ | |
navigator.cascades.postMessage(JSON.stringify({ action:"ajax", options:options })); | |
navigator.cascades.onmessage = function(message){ | |
var params=JSON.parse(message); | |
if (params.action=="ajaxCallback"){ | |
if (params.success && options.success){ | |
options.success(params.data); | |
}else if (params.error){ | |
options.error(params.req, params.err); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment