'use strict'; /*@ Ox.Clipboard Basic clipboard handler add Add items to clipboard (items[, type]) -> Number of items clear Clear clipboard () -> Number of items copy Copy items to clipboard (items[, type]) -> Number of items paste Paste items from clipboard () -> Items type Get item type () -> Item type @*/ Ox.Clipboard = (function() { var clipboard = {items: [], type: void 0}; return { _print: function() { Ox.print(JSON.stringify(clipboard)); }, add: function(items, type) { if (type != clipboard.type) { Ox.Clipboard.clear(); } clipboard = {items: clipboard.items.concat(items), type: type}; return clipboard.items.length; }, clear: function() { clipboard = {items: [], type: void 0}; return clipboard.items.length; }, copy: function(items, type) { clipboard = {items: items, type: type}; return clipboard.items.length; }, paste: function(type) { return !type || type == clipboard.type ? clipboard.items : []; }, type: function() { return clipboard.type; } }; }());