Skip to content

Commit

Permalink
added named arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
spocke committed Dec 7, 2021
1 parent 7ea6680 commit e7b15ac
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Webapi/Dom/Webapi__Dom__DataTransfer.res
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type effectAllowed = [
// old interface
@get external types: t => array<string> = "types"
@send external getData: (t, string) => string = "getData"
@send external setData: (t, string, string) => unit = "setData"
@send external setData: (t, ~format: string, string) => unit = "setData"
@send external clearData: (t, string) => unit = "clearData"
@send external clearAllData: t => unit = "clearData"
@get external files: t => Webapi__FileList.t = "files"
Expand Down
2 changes: 1 addition & 1 deletion src/Webapi/Dom/Webapi__Dom__DataTransferItemList.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type t

@get external length: t => int = "length"
@get_index external get: (t, int) => option<Webapi__Dom__DataTransferItem.t> = ""
@send @return(nullable) external addString: (t, string, string) => option<Webapi__Dom__DataTransferItem.t> = "add"
@send @return(nullable) external addString: (t, string, ~format: string) => option<Webapi__Dom__DataTransferItem.t> = "add"
@send @return(nullable) external addFile: (t, Webapi__File.t) => option<Webapi__Dom__DataTransferItem.t> = "add"
@send external remove: (t, int) => unit = "remove"
@send external clear: t => unit = "clear"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let items = DataTransfer.make()->DataTransfer.items
let length: int = items->length
let item: option<Webapi__Dom__DataTransferItem.t> = items->get(1)

items->addString("text", "text/plain")->ignore
items->addString("text", ~format="text/plain")->ignore
// items->addFile(file) - we can't really make a file see #52
items->remove(10)
items->clear
2 changes: 1 addition & 1 deletion tests/Webapi/Dom/Webapi__Dom__DataTransfer__test.res
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dataTransfer->setDragImage(document->Document.createElement("div"), 10, 10)

let types: array<string> = dataTransfer->types
let data: string = dataTransfer->getData("text/plain")
dataTransfer->setData("text/plain", "text")
dataTransfer->setData(~format="text/plain", "text")
dataTransfer->clearData("text/plain")
dataTransfer->clearAllData
let files: Webapi__FileList.t = dataTransfer->files
Expand Down

0 comments on commit e7b15ac

Please sign in to comment.