WebAPI/Inter App Communication Alt proposal: Difference between revisions

Jump to navigation Jump to search
(s/connectionsRegistered/getConnections)
Line 219: Line 219:
The lockscreen, in this example, wants to control '''only''' (no reasons, just an example) the music from the Gaia Music app (known origin). Once the lockscreen is ready, it sends a connection request of this kind:
The lockscreen, in this example, wants to control '''only''' (no reasons, just an example) the music from the Gaia Music app (known origin). Once the lockscreen is ready, it sends a connection request of this kind:


  connect('musicremotecontrol').then((function onConnectionAccepted(ports) {
  connect('musicremotecontrol', {
  manifestURLs: ['app://music.gaiamobile.org/manifest.webapp']
}).then((function onConnectionAccepted(ports) {
   if (ports.length > 1) {
   if (ports.length > 1) {
     // We shouldn't be here as we only want to communicate with the Gaia Music app.
     // We shouldn't be here as we only want to communicate with the Gaia Music app.
Line 249: Line 251:
  }, function onConnectionRejected(reason) {
  }, function onConnectionRejected(reason) {
   ...
   ...
}, {
  manifestURLs: ['app://music.gaiamobile.org/manifest.webapp']
  }).bind(this));
  }).bind(this));


Confirmed users
483

edits

Navigation menu