-
Notifications
You must be signed in to change notification settings - Fork 161
Refresh DataTransfer API #763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
976316c
5871123
ff85260
001c22a
c3d4492
77404c2
932bb1b
d15fbef
5a67f9f
95127c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
@js.native | ||
sealed trait DragDataItemKind extends js.Any | ||
|
||
object DragDataItemKind { | ||
val string: DragDataItemKind = "string".asInstanceOf[DragDataItemKind] | ||
val file: DragDataItemKind = "file".asInstanceOf[DragDataItemKind] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
@js.native | ||
sealed trait DropEffectValue extends js.Any | ||
|
||
object DropEffectValue { | ||
val none: DropEffectValue = "none".asInstanceOf[DropEffectValue] | ||
val copy: DropEffectValue = "copy".asInstanceOf[DropEffectValue] | ||
val link: DropEffectValue = "link".asInstanceOf[DropEffectValue] | ||
val move: DropEffectValue = "move".asInstanceOf[DropEffectValue] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
@js.native | ||
sealed trait EffectAllowedValue extends js.Any | ||
|
||
object EffectAllowedValue{ | ||
val none: EffectAllowedValue = "none".asInstanceOf[EffectAllowedValue] | ||
val copy: EffectAllowedValue = "copy".asInstanceOf[EffectAllowedValue] | ||
val copyLink: EffectAllowedValue = "copyLink".asInstanceOf[EffectAllowedValue] | ||
val copyMove: EffectAllowedValue = "copyMove".asInstanceOf[EffectAllowedValue] | ||
val link: EffectAllowedValue = "link".asInstanceOf[EffectAllowedValue] | ||
val linkMove: EffectAllowedValue = "linkMove".asInstanceOf[EffectAllowedValue] | ||
val move: EffectAllowedValue = "move".asInstanceOf[EffectAllowedValue] | ||
val all: EffectAllowedValue = "all".asInstanceOf[EffectAllowedValue] | ||
val uninitialized: EffectAllowedValue = "uninitialized".asInstanceOf[EffectAllowedValue] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
opaque type DragDataItemKind <: String = String | ||
|
||
object DragDataItemKind { | ||
val string: DragDataItemKind = "string" | ||
val file: DragDataItemKind = "file" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
opaque type DropEffectValue <: String = String | ||
|
||
object DropEffectValue { | ||
val none: DropEffectValue = "none" | ||
val copy: DropEffectValue = "copy" | ||
val link: DropEffectValue = "link" | ||
val move: DropEffectValue = "move" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
opaque type EffectAllowedValue <: String = String | ||
|
||
object EffectAllowedValue { | ||
val none: EffectAllowedValue = "none" | ||
val copy: EffectAllowedValue = "copy" | ||
val copyLink: EffectAllowedValue = "copyLink" | ||
val copyMove: EffectAllowedValue = "copyMove" | ||
val link: EffectAllowedValue = "link" | ||
val linkMove: EffectAllowedValue = "linkMove" | ||
val move: EffectAllowedValue = "move" | ||
val all: EffectAllowedValue = "all" | ||
val uninitialized: EffectAllowedValue = "uninitialized" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API | ||
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later. | ||
* http://creativecommons.org/licenses/by-sa/2.5/ | ||
* | ||
* Everything else is under the MIT License http://opensource.org/licenses/MIT | ||
*/ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
/** Each DataTransferItem object is associated with a [[DataTransfer]] object. */ | ||
@js.native | ||
trait DataTransferItem extends js.Object { | ||
zetashift marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** Returns the drag data item kind, one of: "string", "file". */ | ||
def kind: DragDataItemKind = js.native | ||
|
||
/** Returns the drag data item type string. */ | ||
def `type`: String = js.native | ||
zetashift marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** Invokes the callback with the string data as the argument, if the drag data item kind is text. */ | ||
def getAsString(callback: () => String) = js.native | ||
zetashift marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** Returns a File object, if the drag data item kind is File. */ | ||
def getAsFile(): js.UndefOr[File] = js.native | ||
zetashift marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API | ||
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later. | ||
* http://creativecommons.org/licenses/by-sa/2.5/ | ||
* | ||
* Everything else is under the MIT License http://opensource.org/licenses/MIT | ||
*/ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
@js.native | ||
trait DataTransferItemList extends js.Object { | ||
|
||
/** Returns the number of items in the drag data store. */ | ||
def length: Int = js.native | ||
|
||
/** Adds a new entry for the given data to the drag data store. If the data is plain text then a type string has to be | ||
* provided also. | ||
*/ | ||
def add(data: String, `type`: String): Unit = js.native | ||
zetashift marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** Adds a new entry for the given data to the drag data store. If the data is plain text then a type string has to be | ||
* provided also. | ||
*/ | ||
def add(data: File): Unit = js.native | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MDN says this has a defined return value :)
https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList/add#return_value |
||
|
||
/** Removes the indexth entry in the drag data store. */ | ||
def remove(index: Int): Unit = js.native | ||
|
||
/** Removes all the entries in the drag data store. */ | ||
def clear(): Unit = js.native | ||
|
||
} | ||
|
||
@js.native | ||
object DataTransferItemList extends DataTransferItemList { | ||
/** Returns the DataTransferItem object representing the indexth entry in the drag data store. */ | ||
def apply(index: Int): DataTransferItem = js.native | ||
} | ||
zetashift marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.