Skip to content

Commit

Permalink
Document the new pasteboard API
Browse files Browse the repository at this point in the history
  • Loading branch information
jfperusse committed Jan 17, 2025
1 parent bb20d74 commit 95afcb0
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
67 changes: 67 additions & 0 deletions docs/source/api/pasteboard.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
pasteboard
==========

Exposes pasteboard functionnalities to copy and paste strings, images, colors and URLs.

To minimize unnecessary notifications when accessing pasteboard data from other applications,
first call ``hasStrings``, ``hasImages``, ``hasColors`` or ``hasURLs`` to check if the desired
data type is available before retrieving it. This prevents a notification when the requested
type is not present, but a notification may still appear if data is accessed.

.. lua:module:: pasteboard
.. lua:attribute:: name: string
The name of the pasteboard.

.. lua:attribute:: numberOfItems: number
The number of items in the pasteboard.

.. lua:attribute:: hasStrings: boolean
Whether the pasteboard contains one or more strings.

.. lua:attribute:: string: string
The first string in the pasteboard.

.. lua:attribute:: strings: table
A table of strings in the pasteboard.

.. lua:attribute:: hasImages: boolean
Whether the pasteboard contains one or more images.

.. lua:attribute:: image: image
The first image in the pasteboard.

.. lua:attribute:: images: table
A table of images in the pasteboard.

.. lua:attribute:: hasColors: boolean
Whether the pasteboard contains one or more colors.

.. lua:attribute:: color: color
The first color in the pasteboard.

.. lua:attribute:: colors: table
A table of colors in the pasteboard.

.. lua:attribute:: hasURLs: boolean
Whether the pasteboard contains one or more URLs.

.. lua:attribute:: URL: string
The first URL in the pasteboard.

.. lua:attribute:: URLs: table
A table of URLs in the pasteboard.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Codea 4
api/tween
api/ui
api/objc
api/pasteboard
api/physics2d
api/physics3d
api/viewer
Expand Down

0 comments on commit 95afcb0

Please sign in to comment.