Handling iOS memory with PhoneGap

I am really surprised that no one has yet asked about this: how do I handle iOS memory warnings using PhoneGap?

In particular, how can I call one of my JS functions when a native iOS application receives a memory warning ?

Thanks!

+6
source share
1 answer

You can create a plugin that calls any js function you want, CDVPlugin already has an overridable onMemoryWarning method.

- (void)onMemoryWarning { NSString * javascriptString = @"yourJSFunctionToManageMemoryWarnings();"; [self.webView stringByEvaluatingJavaScriptFromString:javascriptString]; } 
+4
source

Source: https://habr.com/ru/post/977956/


All Articles