我正在开发一个执行强计算操作的角度库。所以我对实现 web worker 很感兴趣,以便有更好的用户体验,让复杂的操作在后台运行。
我的问题是,当我ng g web-worker使用 Angular CLI 8运行命令时,输出是Web Worker requires a project type of "application".
有人对如何继续在我的库中实现 Web Worker 有任何建议吗?
我正在考虑在我的 Android 应用程序中实现 MLKit 人脸识别库。我唯一不明白的是,如果可能的话,我如何比较两张照片并检测它们是否是同一个人。我已阅读这些指南:
谢谢
我正在使用 HTTP 拦截器来向请求添加身份验证令牌,但是当 http 客户端触发请求时,该请求会被拦截并发送两次
这是我的 HttpClient 调用
searchProd(query: string, limit?: number): Observable<Product[]> {
let _limit = limit || 5;
return this.http.get<Product[]>(`${API_CONST.HOST}/${API_CONST.PRODUCT}?search=${query}&limit=${_limit}`);
}
Run Code Online (Sandbox Code Playgroud)
这是我的 app.module.ts
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { TokenInterceptor } from './auth/token.interceptor';
....
@NgModule({
declarations: [
...
],
imports: [
...
],
providers: [
ApiService,
AuthGuardService,
SettingsService,
{
provide : HTTP_INTERCEPTORS,
useClass : TokenInterceptor,
multi : true
}
],
entryComponents: [ ... ],
bootstrap: [ ... ]
})
Run Code Online (Sandbox Code Playgroud)
这是我的 token.interceptor.ts
import { Injectable } …Run Code Online (Sandbox Code Playgroud) 我有一个 PWA,我将用户设置保存在本地存储上,并且我想通过 TWA 将此 PWA 部署在 Play 商店上。问题如下:
The host app doesn't have direct access to web content in a Trusted Web
activity or any other kind of web state, like cookies and localStorage.
Nevertheless, you can coordinate with the web content by passing data to and
from the page in URLs (e.g. through query parameters, custom HTTP headers, and
intent URIs.)
Run Code Online (Sandbox Code Playgroud)
根据谷歌的说法,我不明白如何在 PWA 上使用 TWA 保存客户端的用户设置。如果您能给我举一个例子,我将不胜感激。