Reputation: 943
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!
Upvotes: 6
Views: 852
Reputation: 53301
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];
}
Upvotes: 4