CB-8210 Use PluginResult for various events from native (close #144)

- Change to send events via plugin message channel: various buttons, pause/resume
This commit is contained in:
Jason Chase
2015-01-05 14:07:22 -05:00
committed by Andrew Grieve
parent c2a6dcb6bd
commit 291f111913
2 changed files with 40 additions and 13 deletions
+18 -3
View File
@@ -1,5 +1,5 @@
// Platform: android
// 12489aed3d93ecc98adfc2091fe566067f2d39fc
// 07125ef9d481fab81c2c29eafec253846f05a8ca
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -1555,12 +1555,27 @@ function onMessageFromNative(msg) {
switch (action)
{
// Button events
case 'backbutton':
case 'menubutton':
case 'searchbutton':
// App life cycle events
case 'pause':
case 'resume':
// Keyboard events
case 'hidekeyboard':
case 'showkeyboard':
cordova.fireDocumentEvent(action);
// Volume events
case 'volumedownbutton':
case 'volumeupbutton':
try {
cordova.fireDocumentEvent(action);
} catch(e) {
console.log('exception firing ' + action + ' event from native:' + e);
}
break;
default:
throw new Error('Unknown event action ' + msg.action);
throw new Error('Unknown event action ' + action);
}
}