在中,
当我这么做时:
ProjectData pd = new ProjectData();
pd.id = null; // let Objectify auto-generate the project id
pd.dateCreated = date;
datastore.put(pd); // put the project in the db so that it gets assigned an id
当运行"datastore.put( pd )“时,数据库将自动为每个pd分配一个唯一的ID。但是,如果我添加父密钥字段:
ProjectData pd_new= new
我在我的应用程序中使用了几个自定义fabric.js类来呈现和封装一些额外的数据属性。
现在我有了由它们生成的JSON数据,我想渲染画布,并使用node.js和fabric的npm包将其写入服务器上的PNG图像。这在内置的fabric类(如fabric.Rect或fabric.Text )中工作得很好,但我的定制总是抛出奇怪的require错误。
基本上,自定义文件如下所示:
fabric.custom.js
// without this node raises "fabric is not defined" error
var fabric = fabric || {};
我的函数构造函数是这样的:
test.js
const myConstructor = function(){
this.hi = 'hi'
console.log(this.hi)
}
export default myConstructor
我和试图在test2.js:中尝试 it
test2.js
const test = await import('./test.js')
new test()
这在TypeError: test is not a constructor中失败了。
然而,如果我导入,它可以正常工作:
test2.js
impor