我创建了一些动画,但它们并没有像我希望的那样工作.我想调试它们,但我找不到办法做到这一点.我没有在angular 2 docs中看到过任何信息......
我错过了什么工具吗?
我想创建按钮,在点击时播放下一首/上一首歌,但他们应该在长按时寻找音乐.
我确实设法改变歌曲,但我找不到搜索方法.还有如何从头开始玩?
有没有办法确定自歌曲开始以来已经过了多少?我发现缓冲区有持续时间,但没有实际播放时间.
在init:
context = new (window.AudioContext || window.webkitAudioContext)()
Run Code Online (Sandbox Code Playgroud)
要播放歌曲:
var buffer = song.buffer
var source = context.createBufferSource()
source.buffer = song.buffer
source.connect(analysers.main)
source.start(0, offset || 0)
Run Code Online (Sandbox Code Playgroud) 如果有可用的路径别名,是否有办法强制 TS 使用路径别名进行导入?(我用的是VSCode)
import { ApiError } from '../../../../libs/shared/src'; // This is imported by default
//import { ApiError } from '@rita/shared'; // I want this
const err: ApiError = { /* ... */ };
Run Code Online (Sandbox Code Playgroud)
Ts 配置提取
import { ApiError } from '../../../../libs/shared/src'; // This is imported by default
//import { ApiError } from '@rita/shared'; // I want this
const err: ApiError = { /* ... */ };
Run Code Online (Sandbox Code Playgroud) google recaptcha 创建了一个没有可访问性属性的 textarea,例如 aria-label。这导致 recaptcha 无法通过 Siteimprove 进行可访问性扫描。
我已经尝试使用 javascript 将 aria-label 属性添加到 textarea,但是我在将它添加到 DOM 后将它添加到元素中,所以我猜这就是可访问性失败的原因。
这是来自 Siteimproves google extension 的文本:
未通过的要求 4.1.2
textarea为空。这是因为没有标签与文本区域相关联,或者 aria-label 属性未添加到文本区域。
我想知道,当类型可以是多种类型时,如何指定与上一个参数的解析类型相同的泛型类型。
function add<T extends (number | string)>(a: T, b: T): T {
if (typeof a === 'string') {
return a + b;
} else if (typeof a === 'number') {
return a + b;
}
}
add('hello', ' world');
add(1, 1);
Run Code Online (Sandbox Code Playgroud)
我希望能够告诉编译器所有T类型都是相同的,无论是数字还是字符串。我可能会错过一些语法。条件类型(在某种程度上)可能是可能的...
我想检查一下库对我传递给它的视频元素做了什么,所以我天真地做了这个:
cosnt videoElement = new Proxy(document.querySelector('video'), {
get(target, key) {
const name = typeof key === 'symbol'? key.toString() : key;
console.info(`Accessing video.${ name }`)
return target[key];
}
});
Run Code Online (Sandbox Code Playgroud)
但是我收到了一个错误:
TypeError:无法在'Node'上执行'contains':参数1不是'Node'类型.
有没有办法让这项工作?
编辑:我已经获得了一些知识,用它更新我的代理作为休闲:
cosnt videoElement = document.querySelector('video');
cosnt proxyElement = new Proxy(videoElement , {
get(target, key) {
if (key == '___element___') {
return video;
}
const name = typeof key === 'symbol'? key.toString() : key;
console.info(`Accessing video.${ name }`);
const value = video[key];
if (value instanceof Function) {
return video[key].bind(video);
} …Run Code Online (Sandbox Code Playgroud) 我只是在摆弄试图理解,因此我的类型是不准确的。
@Resolver()
export class ProductsResolver {
@Query(() => [Product])
async products() {
return [{
id: 55,
name: 'Moonshine',
storeSupplies: {
London: 25,
Berlin: 0,
Monaco: 3,
},
}];
}
}
Run Code Online (Sandbox Code Playgroud)
如果我要求查询以下数据
{
products{
id,
name,
}
}
Run Code Online (Sandbox Code Playgroud)
我想async carriers()收到['id', 'name']。我想跳过获取,storeSupplies因为这可能是一个昂贵的SQL调用。
我是GraphQL的新手,我可能错过了一些显而易见的甚至整个模式。提前致谢。
我想找到一种方法将HTML(为控制器优化)插入警报div.但是我找不到办法做到这一点......
<script type="text/ng-include" id="login.html">
<form data-select="exeption" class="loginBox shadowed" onclick="event.stopPropagation();" novalidate name="login">
<h2>Login alert</h2>
<!--inputs and such, they need to be controlled by the controller-->
</form>
</script>
<script type="text/ng-include" id="bug.html">
<form data-select="exeption" class="bugBox shadowed" onclick="event.stopPropagation();" novalidate name="report">
<h2>Bug report</h2>
<!--inputs and such, they need to be controlled by the controller-->
</form>
</script>
Run Code Online (Sandbox Code Playgroud)
这两个模板应该由JS本身或用户引发.那些模板应该进入这个div,但是我无法使用,innerHTML因为在模板中有一些ng模型和类似的东西......
<div id="alert" data-ng-click="empty()" data-ng-controller="alert" role="navigation"></div>
Run Code Online (Sandbox Code Playgroud) 使用时我遇到UTF8字符问题SanitizeValueStrategy('sanitize').我必须使用它,因为客户端使用语言文件来编辑文本,他可能会使用像<b>或<i>...
我只需要使用json文件进行翻译.客户端不会触摸应用程序代码来更改任何文本.JSON文件:
{
"H1": "Typy dom?",
"NAME": "K?estní"
}
Run Code Online (Sandbox Code Playgroud)
只有在使用角度插值时才会出现问题:
<h1 translate>houseTypes.H1</h1>
Typy dom?
Run Code Online (Sandbox Code Playgroud)
我可以使用这种方法将文本放在元素的主体内部,但这些问题仍然存在于属性中.
<input placeholder="'houseTypes.NAME'|translate"></h1>
Křestní
Run Code Online (Sandbox Code Playgroud)
问题是:
如何才能正确编写UTF8字符,而只在插值中使用JSON静态文件加载器,或者在属性中使用任何其他方式placeholder.
我有一个场景,其中 API 接收多个响应(一次一个)并在 UI 上呈现。API 继续轮询数据库,直到接收完所有响应为止。我需要我的脚本等待 API 响应变为“完成”。我尝试了下面的代码,但它没有等到状态完成。
const response = await page.waitForResponse(response => response.url().includes('https://services/url') && response.status() === 200);
console.log('RESPONSE ' + (await response.body()));
Run Code Online (Sandbox Code Playgroud)
以下是记录的响应
{
"transactionDetail": {
"transactionID":"866f357f-7541-4ff2-b879-61ca284513a7",
"transactionTimestamp":"2021-08-02T10:48:50.372207",
"inLanguage":"en-US",
"serviceVersion":"1"
},
"resultSummary":{
"inputCount":1,
"successCount":1,
"failureCount":0},
"inquiryDetail": {
"kaseIterationId":"8a7b11547af8835d017b067ad06e04ba"
},
},
"response":"InProgress"
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能让我的脚本等到“响应”变成“已完成”而不是“进行中”。
javascript ×4
typescript ×3
angular ×2
angularjs ×2
debugging ×1
generics ×1
graphql ×1
html ×1
html5-audio ×1
html5-video ×1
import ×1
nestjs ×1
playwright ×1
protractor ×1
proxy ×1
recaptcha ×1
utf-8 ×1