UNPKG

cordova-plugin-memory-alert

Version:

Cordova plugin dispatching iOS native memory events to javascript.

45 lines (30 loc) 1.18 kB
# cordova-plugin-memory-alert Cordova plugin designed to dispatch native memory events to javascript. Current version is only propagating iOS memory warnings. ## Basic usage ```javascript window.addEventListener('cordova-plugin-memory-alert.memoryWarning', function () { console.log('received a memory warning'); } ); cordova.plugins.CordovaPluginMemoryAlert.activate(true); ``` ## API ### CordovaPluginMemoryAlert.activate Activate or disable event propagation (turned off by default). ``` cordova.plugins.CordovaPluginMemoryAlert.activate(value); ``` - **value:** boolean, `true` to activate, `false` to disable. ### CordovaPluginMemoryAlert.setEventName 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 ##### Quick example ```javascript cordova.plugins.CordovaPluginMemoryAlert.setEventName('memWarning'); window.addEventListener('memWarning', function () { console.log('received a memory warning'); }); cordova.plugins.CordovaPluginMemoryAlert.activate(true); ```