在我们的应用程序中,我们有这些代码
export function compose<T>(
initial: T,
tasks: { [name: string]: (state: T, payload?: any) => void },
copy = CopyStrategy.json
) {
return (state: T = initial || <T>{}, action: any) => {
let reply = null;
const task = tasks[action.type];
if (task) { task(reply, action.payload); }
return reply;
};
}
Run Code Online (Sandbox Code Playgroud)
这就是它的使用方式
export const timeSheetReducer = compose<TimeSheetState>(timeSheetInitial, {
['timehsheet']: (state, payload) => {
....
},
['timehsheetSetStatus']: (state, payload) => {
....
}
},
Run Code Online (Sandbox Code Playgroud)
我不明白这部分的tasks: { [name: string]: (state: T, …
我有一个像下面这样的模拟服务
const firebaseService = jest.fn(() => ({
initializeApp: jest.fn(() => { /*do nothing*/}),
}))
Run Code Online (Sandbox Code Playgroud)
在我的测试中,我想要expectifinitializeApp已经被调用。我该如何检查?
it('should be called', () => {
expect(???).toHaveBeenCalledTimes(1);
});
Run Code Online (Sandbox Code Playgroud)
const collection = jest.fn(() => {
return {
doc: jest.fn(() => {
return {
collection: collection,
update: jest.fn(() => Promise.resolve(true)),
onSnapshot: jest.fn(() => Promise.resolve(true)),
get: jest.fn(() => Promise.resolve(true))
}
}),
where: jest.fn(() => {
return {
get: jest.fn(() => Promise.resolve(true)),
onSnapshot: jest.fn(() => Promise.resolve(true)),
limit: jest.fn(() => {
return {
onSnapshot: jest.fn(() …Run Code Online (Sandbox Code Playgroud) 我已经开发了一个自定义代码生成器并通过VSIX进行部署,问题是我应该在安装VSIX后通过regasm.exe注册程序集,但我看到一些项目,如DSLTool,自定义代码生成,自动注册,任何机构都知道如何我可以在我的VSIX项目中自动注册吗?
我试图在phonegap中为我的应用程序制作自定义字体.为此,我在我的html文件中编写了这段代码:
@font-face {
font-family: 'customfont';
src: url('fonts/BMitra.eot?#') format('eot'),
url('fonts/BMitra.woff') format('woff'),
url('fonts/BMitra.ttf') format('truetype');
font-style: normal;
}
body {
font-family: "customfont";
font-size:30px;
}
Run Code Online (Sandbox Code Playgroud)
....
<body>
<h>Custom Fonts</h>
<div style="font-family: 'customfont';" id='txt1'>This is for sample</div>
</body>
Run Code Online (Sandbox Code Playgroud)
它在Ripple(chrome模拟器)上工作正常,但它不适用于设备(Samsung Android 4.1.2)
我有googled和stack-overflowed找到解决方案,我发现这个帖子在android 4.0.x上的font-face无法正常工作,text-rendreing:auto但它也没有用.
任何帮助将不胜感激.
我想部署一个简单的新创建Cordova的应用程序Mac从vs2015看来,该项目成功打造,但我得到了下面的错误在Visual Studio中,没有应用程序被安装或仿真器上运行.
启动启动过程C:\ Program Files(x86)\nodejs \node.exe"C:\ Users\RezaR\AppData\Roaming \npm \node_modules\vs-tac\emulator.js"--platform ios --action launch - -path"c:\ users\rezar\documents\visual studio 2015\Projects\BlankCordovaApp2\BlankCordovaApp2\bld\ios\Debug\buildInfo.json"--serverUrl http:// RezaMac:3015/cordova --language en-US --loglevel warn --cliVersion 5.4.1 --npmInstallDir"C:\ Users\RezaR\AppData\Roaming \npm"--deployTarget"iPhone 5S"超时将调试器连接到远程Apache Cordova应用程序.请参阅JavaScript控制台输出的输出窗口.
------已安装Cordova工具5.4.1.在iOS模拟器上为服务器上的buildNumber 1462请求模拟http:// RezaMac:3015/cordova ...无法为构建c:\ users\rezar\documents\visual studio 2015\Projects\BlankCordovaApp2\BlankCordovaApp2\bld \启动iOS远程ios\Debug\buildInfo.json为http:// RezaMac:3015/cordova用于部署目标iPhone 5S:Http 404:{"command":"build","vcordova":"5.4.1","cfg":"调试" "日志级别": "警告", "状态": "错误", "buildCommand": "建", "buildPlatform": "IOS", "配置": "调试", "buildLang":"恩美国" "buildDir": "/用户/ RezaRa/.taco_home /远程建立/玉米面豆卷的远程/构建/ 1462", "buildNumber":1462, "选项": "", "日志级别":0," submissionTime ":" 2016-03-12T21:30:32.929Z", "修改列表":{ "deletedFiles":[]}, "buildSuccessful":真, "邮件ID": "EmulateFailedTimeout", "messageArgs":[空], "message":"错误:启动iOS模拟器超时.","tgzFilePath":"/ …
我正在尝试将 Nestjs 应用程序部署到 google 应用引擎,但出现sh: 1: exec: nest: not found错误
我的包.json
"main": "dist/main.js",
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json",
"gcp-build": "npm run build",
"ae:deploy": "gcloud app deploy --quiet",
"ae:browse": "gcloud app …Run Code Online (Sandbox Code Playgroud) 我正在使用Visual Studio 2013中的多设备混合应用程序使用Cordova开发移动应用程序,一切都很好的调试配置,应用程序将正确编译并安装在设备上.但是当我尝试通过Release或Distribution配置进行编译和部署时,它会给我这个错误
Error code 1 for command: cmd with args: /s,/c,ant,release,-f,d:\PhoneGap\projects\MyWeddingCard\MyWeddingCard\bld\Distribution\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
1> Command finished with error code 2: d:\phonegap\projects\MyWeddingCard\MyWeddingCard\bld\Distribution\platforms\android\cordova\build.bat --release,
1>
1> C:\Users\RezaRa\AppData\Roaming\npm\node_modules\vs-mda\node_modules\q\q.js:126
1> throw e;
1> ^
1>EXEC : error : d:\phonegap\projects\MyWeddingCard\MyWeddingCard\bld\Distribution\platforms\android\cordova\build.bat: Command failed with exit code 2
1> at ChildProcess.whenDone (C:\Users\RezaRa\AppData\Roaming\npm\node_modules\vs-mda\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
1> at ChildProcess.emit (events.js:98:17)
1> at maybeClose (child_process.js:756:16)
1> at Process.ChildProcess._handle.onexit (child_process.js:823:5)
Run Code Online (Sandbox Code Playgroud)
我知道这是一个普遍的错误,但有什么方法可以解决问题.
ps我创建了Keystore文件并添加到ant.properties文件中.
我编译了适用于ios模拟器和Android的应用程序(使用delphi xe5),一切正常,但是当我为Appstore配置编译应用程序时,出现此错误,我在错误中进行了搜索,但没有发现任何帮助。
element中缺少必需的属性“ Include”。E:\ Users \ RezaRa \ AppData \ Roaming \ Embarcadero \ BDS \ 12.0 \ iPhoneOS6.1.sdk
任何的想法?
我按照https://www.stewright.me/2021/03/add-header-api-key-to-nestjs-rest-api/制定了 api-key 策略
它有效,我在标头中传递 api-key 并对其进行授权。
现在,对于某些情况,我需要将 api-key 作为查询参数传递给 url 而不是 header。我无法弄清楚。
示例 mysite.com/api/book/5?api-key=myapikey
我当前的代码是
api-密钥策略.ts
@Injectable()
export class ApiKeyStrategy extends PassportStrategy(Strategy, 'api-key') {
constructor(private configService: ConfigService) {
super({ header: 'api-key', prefix: '' }, true, async (apiKey, done) =>
this.validate(apiKey, done)
);
}
private validate(apiKey: string, done: (error: Error, data) => any) {
if (
this.configService.get(AuthEnvironmentVariables.API_KEY) === apiKey
) {
done(null, true);
}
done(new UnauthorizedException(), null);
}
}
Run Code Online (Sandbox Code Playgroud)
api-key-auth-gurad.ts
import { Injectable } from '@nestjs/common';
import { AuthGuard } …Run Code Online (Sandbox Code Playgroud) cordova ×3
android ×2
javascript ×2
nestjs ×2
delphi ×1
delphi-xe5 ×1
docker ×1
font-face ×1
fonts ×1
ios ×1
jestjs ×1
node.js ×1
passport.js ×1
persian ×1
regasm ×1
taco ×1
ts-jest ×1
typescript ×1
vsix ×1