根据W3Schools,超时是必需参数.但是可以在没有超时参数的情况下调用它.
function eventHandler(e) {
var t = setTimeout(function () {
//clearTimeout(t);
alert('Called');
});
}
Run Code Online (Sandbox Code Playgroud) 首先,我想说我是 Hapi 的新手,所以不要对我太苛刻。
我正在按照本教程尝试使用catbox和catbox-redis npm包设置基于 Redis 的服务器端缓存,但出现以下错误:
{
reason: Error: Connection is closed.
at Redis.connectionCloseHandler (/home/yuriy/dev/sources/all/hapi-getting-started/node_modules/ioredis/built/redis/index.js:305:24)
at Object.onceWrapper (events.js:300:26)
at Redis.emit (events.js:210:5)
at processTicksAndRejections (internal/process/task_queues.js:75:11)
}
Run Code Online (Sandbox Code Playgroud)
如您所见,它说错误在ioredis(v4.14.1 根据 package-lock.json) 包中,它是catbox-redis.
我在本地运行 Redis 服务器。
username@my-computer:~$ redis-cli -v
redis-cli 4.0.9
username@my-computer:~$ redis-cli
127.0.0.1:6379> ping
PONG
Run Code Online (Sandbox Code Playgroud)
这是我的package.json:
{
"name": "hapi-getting-started",
"version": "1.0.0",
"description": "",
"main": "src/index.ts",
"scripts": {
"build": "rimraf dist && tsc",
"start": "rimraf dist && tsc && node dist/index.js", …Run Code Online (Sandbox Code Playgroud) 正如我在主题中已经提到的,我有一个MVC站点,我需要禁用将其加载到IFrame中.
我已经创建了用于测试目的的简单页面,我尝试加载到我的网站和Google.com的两个IFrame中.我可以看到我的网站已加载但谷歌不是.这意味着我需要在我的MVC网站中更改某些内容.
<!DOCTYPE html>
<html>
<body>
<iframe src="http://localhost:61831/" width="1200" height="800">
<p>Your browser does not support iframes.</p>
</iframe>
<iframe src="http://google.com" width="1200" height="800">
<p>Your browser does not support iframes.</p>
</iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
那么在MVC网站中我必须写什么以及在哪里实现呢?