Skip to main content

Posts

Showing posts with the label window.open

How to loop through and extract property values from a complex object (Array)?

The following snippet is from an opensource poker client written in JQuery. It displays a poker table that has been previously spawned by the poker server. The table is displayed within a div on the page after the page is loaded. // // featured table // jpoker.plugins.featuredTable = function(url, options) { var opts = $.extend({}, jpoker.plugins.featuredTable.defaults, options); var server = jpoker.url2server({ url: url }); server.registerUpdate(function(server, what, packet) { if (packet && packet.type == 'PacketPokerTableList') { if (packet.packets.length === 0) { var updated = function(server, what, packet) { if(packet && packet.type == 'PacketPokerTableList') { var found = null; for(var i = packet.packets.length - 1; i >= 0 ; i--) { var subpacket = packet.packets[i]; if(opts.compare(found, subpacket) >= 0) { found = subpacket;