我想生成这样的东西:
http://www.ivarvong.com/2010/08/node-js-connect-mongoose-and-underscore/
但我想生成html模板和其他客户端代码,要么具有泛型/单片保存/查询/读取,要么为Node.js代码和客户端(jQuery或其他)生成个性化的代码,所有这些都基于在模型上.
因此,像使用下划线填写基于一些Monogoose(MongoDB的)模型的几个模板.根据你的HTML表单有人能填补型号,某些客户端和服务器端的代码将数据保存在模型MongoDB的,还有一些代码,以在列表或表模型显示数据.
在我的angular 2应用程序中,有一个包含一个对象数组的组件,它将所选(单击的)一个传递给它的直接子组件.这确实显示了更详细的数据.我正在使用"SimpleChanges"功能来监视此子组件,如果给定的对象发生更改,则发出另一个http请求以从数据库获取相关注释.
如果我尝试使用npm构建它,我会收到错误,说:
app/displayEntry.component.ts(23,41):错误TS2339:类型'SimpleChanges'上不存在属性'entry'
如果我只是评论这个部分,启动npm,最后把它放在那里并保存,没有问题了(没有错误,它的工作原理).我的问题是,有没有办法解决这种行为,这可能导致任何麻烦,以后我没有预见或我应该忽略它?谢谢你的帮助
父组件:
import { Component, OnInit } from '@angular/core';
import { entry } from './Objekte/entry';
import { entryService } from './entry.service'
@Component({
templateUrl: 'app/Html_Templates/displayLastEntrys.template.html'
})
export class displayLastEntrys implements OnInit{
public entrys : entry[];
private entryChoosen: boolean;
private ChoosenEntry : entry;
constructor ( private entryservice : entryService){
this.entryChoosen = false;
}
ngOnInit() : void {
this.getData();
}
getData() {
this.entryservice.getFirstEntrys().then(entrys => this.entrys = entrys);
}
entryClicked(ent: entry){
this.entryChoosen = true;
this.ChoosenEntry = ent;
}
leaveEntry () …Run Code Online (Sandbox Code Playgroud) 我有一个网页上运行,用画JavaScript客户端requestAnimationFrame到画布上,并通过沟通的WebSockets到我的NodeJS后端服务器(使用"WS"模块在服务器端).
使用Chrome DevTools进行分析,似乎每帧的脚本,渲染和绘制的总时间最多只有几毫秒.然而,仍有20至40毫秒的长时间帧.
时间线显示,在几乎所有这些情况下,都存在超过帧长度的"响应"和/或朝向末端发生的"复合层".
这基本上就是我使用requestAnimationFrame的方式:
function drawGame() {
// Drawing to gameCanvas from cacheCanvas
// cacheCanvas is updated whenever an update is received from the server
ctx.drawImage(cacheCanvas,
// source rectangle
0, 0,
gameCanvas.width*2, gameCanvas.height*2,
// destination
100, 100,
gameCanvas.width*2, gameCanvas.height*2
);
requestAnimationFrame(drawGame);
}
requestAnimationFrame(drawGame);
Run Code Online (Sandbox Code Playgroud)
服务器使用setInterval()以60hz发送更新.当从服务器收到消息时,客户端立即绘制它.我怀疑这个时间与requestAnimationFrame结合可能是不正确的,并且导致帧结尾处的复合层.
即使这样,我也很困惑为什么在每个帧的脚本和"复合层"之间有这么多空闲时间.所以...
有没有办法控制何时调用"复合层"?
我应该保存每个更新消息中的数据,只在下一个动画帧的开头绘制它吗?
什么是"回应"指的是什么?
谢谢!
node.js ×3
angular ×1
canvas ×1
crud ×1
html5 ×1
http ×1
javascript ×1
mongodb ×1
typescript ×1
web ×1