Model.GetData(function (args,jsonData) {
RenderData(jsonData);
});
I am passing a callback to my model class,
var Model = (function () {
function GetData(args,callback) {
// do all math works.
var HTTPClient;
HTTPClient.onload = function () {
callback(this.responseText);
};
}
})();
Will my callback cause memory leak in my view page.
Yes. The onload
global variable will store a reference to your function, which is in the same scope as your args
and callback
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.