简体   繁体   English

带有 Angular 7 的 Tizen 可穿戴 Web 应用程序

[英]Tizen wearable web application with Angular 7

I'm trying to create a Tizen wearable web application using Angular 7.我正在尝试使用 Angular 7 创建一个 Tizen 可穿戴 Web 应用程序。

The idea is to realize a simple angular app and then put the build files (obtained with ng build --prod command) inside a Tizen Studio base project.这个想法是实现一个简单的 angular 应用程序,然后将构建文件(通过 ng build --prod 命令获得)放在 Tizen Studio 基础项目中。 This way I can build to a wearable device.通过这种方式,我可以构建可穿戴设备。

Everything seems to work properly but now I'm facing a couple of problems:一切似乎都正常,但现在我面临几个问题:

  1. I need to use a code snippet like the following inside an angular component but ' tizen ' is not found.我需要在 angular 组件中使用如下所示的代码片段,但未找到“ tizen ”。 I figure I have to import tizen library somehow but I've no idea how to proceed (even where to find this library).我想我必须以某种方式导入 tizen 库,但我不知道如何继续(甚至在哪里可以找到这个库)。

    tizen.application.getCurrentApplication().exit();

  2. I would like to use TAU (Tizen Advanced UI) directly inside angular code but I'm not able to import the library.我想直接在 angular 代码中使用 TAU(Tizen Advanced UI),但我无法导入库。 I'm looking for some npm package or another way to import and use it.我正在寻找一些 npm 包或其他导入和使用它的方式。

Any suggestion is well accepted.任何建议都被很好地接受。

Thanks in advance!提前致谢!

  1. You can use (<any>window).tizen.application... or even better, extend Window interface with tizen object. 您可以使用(<any>window).tizen.application...甚至更好,使用tizen对象扩展Window界面。
  2. TAU library is based on jQuery mobile - it is not designed to work with Angular. TAU库基于jQuery mobile-它不能与Angular一起使用。 These frameworks are completely different. 这些框架是完全不同的。

The comment above, worked for me.上面的评论对我有用。

I implemented on the first page of my app an event to listen the return button of the remote (keyCode = 10009) and to close the application, i implemented the code above.我在我的应用程序的第一页上实现了一个事件来监听遥控器的返回按钮(keyCode = 10009)并关闭应用程序,我实现了上面的代码。

import {Component, HostListener, OnInit} from '@angular/core';
@Component({
   selector: 'app-mycomponent',
   templateUrl: './my.component.html',
   styleUrls: ['./my.component.scss'],
})
export class MyComponent implements OnInit {
   static KEYCODE_RETURN_TIZEN = 10009;
  @HostListener('window:keydown', ['$event']) onClick(event: KeyboardEvent) {
     if ([MyComponent.KEYCODE_RETURN_TIZEN].includes(event.keyCode)) {
     // Implement any confirm component
     (window as any).tizen.application.getCurrentApplication().exit();
    }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM