I am really surprised no one has asked this yet: how do I handle iOS memory warnings with PhoneGap?
Specifically, how do I call one of my JS functions when the iOS native application receives a memory warning?
Thanks!
You can create a plugin that calls any js function you want, CDVPlugin already have an overridable onMemoryWarning method.
- (void)onMemoryWarning
{
NSString * javascriptString = @"yourJSFunctionToManageMemoryWarnings();";
[self.webView stringByEvaluatingJavaScriptFromString:javascriptString];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With