Labs/Jetpack/JEP/10: Difference between revisions

Line 26: Line 26:


<pre class="brush:js;toolbar:false;">
<pre class="brush:js;toolbar:false;">
jetpack.os.clipboard.set( options )
jetpack.os.clipboard.set( data, [dataType] )
</pre>
</pre>


''Arguments''
''Arguments''


<code>data</code>: The value to be placed into the system clipboard. It can be anything, a string, a unicode string, a number, an image, and HTML fragment, etc.
<code>data</code>: The value to be placed into the system clipboard. For now, this can only be text or an image. In the future, it can be anything that is place-able on the system clipboard.


<code>dataType</code> (optional): Let's Jetpack know what kind of data is being passed in, in [http://en.wikipedia.org/wiki/Internet_media_type mime-type format]. For example, a unicode string would take <code>"text/unicode"</code>, HTML would be <code>"text/html"</code>, and an PNG would be <code>"image/png"</code>. If <code>dataType</code> isn't passed in, Jetpack makes its best guess.
<code>dataType</code> (optional): Let's Jetpack know what kind of data is being passed in, in [http://en.wikipedia.org/wiki/Internet_media_type mime-type format]. For example, a plain string would take <code>"text/plain"</code>, HTML would be <code>"text/html"</code>, and an PNG would be <code>"image/png"</code>. If <code>dataType</code> isn't passed in, Jetpack makes its best guess or defaults to text.


<pre class="brush:js;toolbar:false;">
<pre class="brush:js;toolbar:false;">
Line 43: Line 43:
''Arguments''
''Arguments''


<code>options</code>: A dictionary containing key-value pairs of <code>data</code> and <code>dataType</code>.
<code>options</code>: A dictionary containing key-value pairs of <code>data</code> and <code>dataType</code>
<code>clipboard</code> some operating systems have more than one clipboard: the "global" clipboard and the "selection" clipboard. You can pass in either "global" or "selection". If you pass in a non-existent clipboard, an error is thrown.


'''Examples'''
'''Examples'''
577

edits