Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Add DataTransfer bindings #208

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ lib/*
!lib/js/tests
lib/js/tests/testHelpers.js
npm-debug.log

# direnv
.envrc

# Nix
shell.nix

# npm
package-lock.json
19 changes: 19 additions & 0 deletions src/Webapi/Dom/Webapi__Dom__DataTransfer.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
type t = Dom.dataTransfer;

[@bs.new] external make: unit => t = "DataTransfer";

[@bs.get] external dropEffect: t => string = "dropEffect";
[@bs.set] external setDropEffect: (t, string) => unit = "dropEffect";
[@bs.get] external effectAllowed: t => string = "effectAllowed";
[@bs.set] external setEffectAllowed: (t, string) => unit = "effectAllowed";
/** TODO: items returns DataTransferItemList: https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-items */
[@bs.send]
external setDragImage: (t, Webapi__Dom__HtmlImageElement.t, float, float) => unit =
"setDragImage";
[@bs.get] external types: t => array(string) = "types";
[@bs.send] external getData: (t, string) => string = "getData";
[@bs.send] external setData: (t, string, string) => unit = "setData";
[@bs.send] external clearData: t => unit = "clearData";
[@bs.send] external clearData0: t => unit = "clearData";
[@bs.send] external clearData1: (t, string) => unit = "clearData";
/** TODO: files returns FileList: https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-files */;
1 change: 1 addition & 0 deletions src/Webapi/Webapi__Dom.re
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module ClipboardEvent = Webapi__Dom__ClipboardEvent;
module CloseEvent = Webapi__Dom__CloseEvent;
module CompositionEvent = Webapi__Dom__CompositionEvent;
module CustomEvent = Webapi__Dom__CustomEvent;
module DataTransfer = Webapi__Dom__DataTransfer;
module Document = Webapi__Dom__Document;
module DocumentFragment = Webapi__Dom__DocumentFragment;
module DocumentType = Webapi__Dom__DocumentType;
Expand Down