tizenbrew-module 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +9 -6
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -2,12 +2,15 @@
2
2
  // If the module is executed in the TizenBrew menu, force-launch the browser
3
3
  if (window.location.href.indexOf('net22.cc') === -1) {
4
4
  try {
5
- // Create a fake link to force the TV to open the native browser
6
- var a = document.createElement('a');
7
- a.href = 'https://net22.cc';
8
- a.target = '_blank';
9
- document.body.appendChild(a);
10
- a.click();
5
+ // Use native Tizen API to launch the TV's built-in web browser
6
+ if (typeof tizen !== 'undefined' && tizen.application && tizen.ApplicationControl) {
7
+ var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view", "https://net22.cc");
8
+ tizen.application.launchAppControl(appControl, null, function() {}, function(e) {
9
+ window.location.href = 'https://net22.cc';
10
+ });
11
+ } else {
12
+ window.location.href = 'https://net22.cc';
13
+ }
11
14
  } catch (e) {
12
15
  window.location.href = 'https://net22.cc';
13
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tizenbrew-module",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Custom TV remote mapping for net22.cc",
5
5
  "main": "index.js",
6
6
  "style": "style.css",
@@ -17,4 +17,4 @@
17
17
  "Enter",
18
18
  "Return"
19
19
  ]
20
- }
20
+ }