Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f096a8b

Browse files
author
Jeremy White
committedMay 5, 2014
Added close support to webOS platform
1 parent b6e7917 commit f096a8b

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed
 

‎dist/connect_bridge.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ var connectsdk = (function () {
289289
this.handleMediaCommand(msgData);
290290
break;
291291

292+
case "connectsdk.serviceCommand":
293+
this.handleServiceCommand(msgData);
294+
break;
295+
292296
default:
293297
this.emit(ConnectManager.EventType.MESSAGE, msgData);
294298
}
@@ -322,6 +326,23 @@ var connectsdk = (function () {
322326
}
323327
},
324328

329+
handleServiceCommand: function (msgData) {
330+
var serviceCommand = msgData.message.serviceCommand;
331+
if (!serviceCommand) {
332+
return;
333+
}
334+
335+
var commandType = serviceCommand.type;
336+
console.log('processing serviceCommand ' + JSON.stringify(serviceCommand) + ' of type ' + commandType);
337+
338+
switch (commandType) {
339+
case "close":
340+
// this is a hack to circumvent the fact that window.close() doesn't work with the webOS app type
341+
window.open(window.location, '_self').close();
342+
break;
343+
}
344+
},
345+
325346
handleDisplayImage: function (msgData) {
326347
var from = msgData.from;
327348
var mediaCommand = msgData.message.mediaCommand;

‎dist/connect_bridge.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎sample/scripts/connect_bridge.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/connect_bridge.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,10 @@ var connectsdk = (function () {
270270
this.handleMediaCommand(msgData);
271271
break;
272272

273+
case "connectsdk.serviceCommand":
274+
this.handleServiceCommand(msgData);
275+
break;
276+
273277
default:
274278
this.emit(ConnectManager.EventType.MESSAGE, msgData);
275279
}
@@ -303,6 +307,23 @@ var connectsdk = (function () {
303307
}
304308
},
305309

310+
handleServiceCommand: function (msgData) {
311+
var serviceCommand = msgData.message.serviceCommand;
312+
if (!serviceCommand) {
313+
return;
314+
}
315+
316+
var commandType = serviceCommand.type;
317+
console.log('processing serviceCommand ' + JSON.stringify(serviceCommand) + ' of type ' + commandType);
318+
319+
switch (commandType) {
320+
case "close":
321+
// this is a hack to circumvent the fact that window.close() doesn't work with the webOS app type
322+
window.open(window.location, '_self').close();
323+
break;
324+
}
325+
},
326+
306327
handleDisplayImage: function (msgData) {
307328
var from = msgData.from;
308329
var mediaCommand = msgData.message.mediaCommand;

0 commit comments

Comments
 (0)
Please sign in to comment.