Hi Mykola,
Try this:
create local variable type object on your screen called onResumeFunc and also one as output parameter on your javascript node:
function onResume() {
// Handle the resume event
$actions.LayoutOnPullToRefresh();
};
$parameters.onResumeFunc = onResume;
document.addEventListener("resume", onResume, false);
After the javascript node set the local screen variable with the output parameter of your javascript node.
The local screen variable you pass into the javascript node for the OnDestroy as input parameter.
document.removeEventListener("resume", $parameters.onResumeFunc, false);
Regards,
Daniel