2016-12-14 89 views
0

方法放入和添加的第二個參數{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. 

回答

2

由於GibboK提到指令是包含有關創建和更新存儲對象信息的對象。

有效的屬性是:

id - String|Number? - ID來作爲新的對象的身份。僅用於add()

beforeId - String? - 新的創建或更新的對象,要放在該屬性之前的id。

overwrite - Boolean? - 指示對象應該或不應覆蓋現有對象。

該文檔可以在代碼「dstore \ Store.js」Store.PutDirective中找到。還有另一個屬性parent未被使用。

dstore\Rest的指令具有附加屬性header - Object?,其中將包含請求的標頭信息。

您可能需要查看您正在使用的商店類型,以獲取可作爲[directives]傳遞的有效對象的完整文檔。

希望這有幫助。

1

指令傳遞給放()和添加()處理用於引導更新 和存儲的對象的創建。

不幸的是,關於directives的文檔非常有限。