什么是指令? dojo dstore

问题描述:

方法放入和添加的第二个参数{directives}是什么? 有人知道你可以放在这里吗?什么是指令? dojo dstore

https://github.com/SitePen/dstore/blob/master/docs/Store.md

put(object, [directives]) This stores an object. It can be used to update or create an object. This returns a promise that may resolve to the object after it has been saved. 

add(object, [directives]) This creates an object, and throws an error if the object already exists. This should return a promise for the newly created object. 

由于GibboK提到指令是包含有关创建和更新存储对象信息的对象。

有效的属性是:

id - String|Number? - ID来作为新的对象的身份。仅用于add()

beforeId - String? - 新的创建或更新的对象,要放在该属性之前的id。

overwrite - Boolean? - 指示对象应该或不应覆盖现有对象。

该文档可以在代码“dstore \ Store.js”Store.PutDirective中找到。还有另一个属性parent未被使用。

dstore\Rest的指令具有附加属性header - Object?,其中将包含请求的标头信息。

您可能需要查看您正在使用的商店类型,以获取可作为[directives]传递的有效对象的完整文档。

希望这有帮助。

指令传递给放()和添加()处理用于引导更新 和存储的对象的创建。

不幸的是,关于directives的文档非常有限。