cordova-plugin-memory-alert
Version:
Cordova plugin dispatching iOS native memory events to javascript.
45 lines (30 loc) • 1.18 kB
Markdown
Cordova plugin designed to dispatch native memory events to javascript. Current version is only propagating iOS memory warnings.
```javascript
window.addEventListener('cordova-plugin-memory-alert.memoryWarning',
function () {
console.log('received a memory warning');
}
);
cordova.plugins.CordovaPluginMemoryAlert.activate(true);
```
Activate or disable event propagation (turned off by default).
```
cordova.plugins.CordovaPluginMemoryAlert.activate(value);
```
- **value:** boolean, `true` to activate, `false` to disable.
Set the name of the event emitted on `window` when a memory warning is received. Default value is `cordova-plugin-memory-alert.memoryWarning`
```
cordova.plugins.CordovaPluginMemoryAlert.setEventName(eventName);
```
- **eventName:** string
```javascript
cordova.plugins.CordovaPluginMemoryAlert.setEventName('memWarning');
window.addEventListener('memWarning', function () { console.log('received a memory warning'); });
cordova.plugins.CordovaPluginMemoryAlert.activate(true);
```