577
edits
| Line 79: | Line 79: | ||
The single value of the requested MIME-type stored in the clipboard. If nothing of that type exists, <code>null</code> is returned. | The single value of the requested MIME-type stored in the clipboard. If nothing of that type exists, <code>null</code> is returned. | ||
<pre class="brush:js;toolbar:false;">jetpack.os.clipboard.get( [dataType], callback )</pre> | |||
There are cases where an application can asynchronously place data in the clipboard. For example, when a copy action is taken on a 50MB picture in Photoshop, instead of the 50MB being placed in the clipboard, Photoshop can place register a "deffered" so that the data isn't actually copied until another application tries to paste. That shuffling of data can take a while, which is why an asynchronous callback is required. However, most of the time this is over-kill as a Jetpack author is normally just copying and pasting text. | |||
''Arguments'' | |||
<code>dataType</code> ''optional'': The MIME-type of data being requested. Like the other signatures of <code>clipboard.get</code>, if the first half of the MIME-type is passed in (e.g., "image"), Jetpack returns the best match of that type. | |||
<code>callback( value )</code>: Gets called when the data available. If <code>dataType</code> was provided, then <code>value</code> is the the value in the clipboard. If it was not provided, then <code>value</code> a dictionary of <code>{data:dataType}</code> pairs. If nothing is in the clipboard <code>null</code> is returned. | |||
'''Examples''' | '''Examples''' | ||
| Line 89: | Line 99: | ||
var img = jetpack.os.clipboard.get( "image" ); | var img = jetpack.os.clipboard.get( "image" ); | ||
$("body").append( img ); | $("body").append( img ); | ||
jetpack.os.clipboard.get( "image", function(img){ | |||
document.body.appendChild( img ); | |||
}); | |||
</pre> | </pre> | ||
edits