{"dist":{"shasum":"498c02cf979f4892cd0bc12310297e775a421f86","tarball":"https://registry.npmjs.org/phantom-sync/-/phantom-sync-0.1.2.tgz","integrity":"sha512-smTLddcBA6gQ4sUORBuFG0QBCZ8K4vY/LiUp3oBGuq4LpiMOho18bj7FiQRBJEc9nFDYK5vp2lRUqfGAcpIKwQ==","signatures":[{"sig":"MEYCIQDYQLR92b3dk74Ajnn2gmZ+DKpGwthJR5kXln/FWltK6QIhAPE9o1bPcFuFtNRPeAO6Nax682Lj6ceaS+EzbEn7wg8D","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./index","name":"phantom-sync","author":{"name":"Seb Vincent","email":"seb.vincent@gmail.com"},"engine":"node >= 0.6.1","readme":"# phantomjs-node-sync\n\nThis is a synchronous version of the [phantom for node](http://github.com/sgentle/phantomjs-node) \nmodule using [fibers](http://github.com/laverdet/node-fibers). There are different modes\navailable, allowing the [PhantomJS](http://www.phantomjs.org/) API to be used synchronously, \nasynchronously, or a mix of both.\n\n\n## install\n\n```\nnpm install phantom-sync\n```\n\n## simple usage (coffeescript)\n\n```coffeescript\n{Phantom,Sync} = require 'phantom-sync'\n\nphantom = new Phantom \n\nSync ->\n  ph = phantom.create()\n  page = ph.createPage()\n  status = page.open \"http://www.google.com\"\n  console.log \"status=\", status  \n  title = page.evaluate ->\n    document.title\n  console.log \"title=\", title\n  ph.exit()  \n```\n\n## API\n\n### async API\n\nSame as [phantom for node](http://github.com/sgentle/phantomjs-node) \n\nWhen using the ['mixed','args'] mode, make sure that a 'done' callback is passed to methods \nlike 'onConsoleMessage' or 'evaluate', even when not expecting return values, otherwise the \nmethods will be called synchronously.\n\n### sync API\n\nThis is the [phantom for node](http://github.com/sgentle/phantomjs-node) API where that callbacks have been transformed into returns. \nTherefore it should be very similar to the [PhantomJS API](http://code.google.com/p/phantomjs/wiki/Interface), \nexcept for the getters/setters function which need to be called like in the following code:\n\n```coffeescript\np.page.set 'settings.loadImages', false\np.page.get 'settings.loadImages'\n```\n\n## modes\n\nPlease refer to [make-sync](http://github.com/sebv/node-make-sync/blob/master/README.markdown#modes) for\ndetailed mode descriptions.\n\n```coffeescript\n# sync (default)\nphantom = new Phantom   \nphantom = new Phantom mode:'sync'   \n# async\nphantom = new Phantom mode:'async'   \n# mixed-args (mixed default)\nphantom = new Phantom mode:'mixed'\nphantom = new Phantom mode:['mixed','args']\n# mixed-fibers\nphantom = new Phantom mode:['mixed','fibers']\n```\n\n\n## mixed mode example (coffeescript)\n\n```coffeescript\n{Phantom,Sync} = require 'phantom-sync'\n\nphantom = new Phantom mode:'mixed' \n\n[page,ph] = [] \n# sync calls\nSync ->\n  console.log \"Step 1\"    \n  ph = phantom.create()\n  page = ph.createPage()\n  status = page.open \"http://www.google.com\"\n  console.log \"status=\", status  \n  title = page.evaluate ->\n    document.title\n  console.log \"title=\", title\n\n# async calls on the the previous objects\nsetTimeout ->\n  console.log \"Step 2\"  \n  page.open \"http://www.yahoo.com\", (status) ->  \n    console.log \"status=\", status  \n    page.evaluate (-> document.title), (title) -> \n      console.log \"title=\", title\n      ph.exit()\n  # using async calls to create a new set of objects\n  setTimeout ->\n    console.log \"Step 3\"  \n    phantom.create (ph2) ->\n      ph2.createPage (page2) ->\n        page2.open \"http://www.apple.com\", (status) ->  \n          console.log \"status=\", status  \n          page2.evaluate (-> document.title), (title) -> \n            console.log \"title=\", title\n            ph2.exit()\n  , 10000  \n, 10000    \n```\n","scripts":{"test":"cake test"},"_npmUser":{"name":"sebv","email":"seb.vincent@gmail.com"},"keywords":["phantom","phantomjs","sync","synchronous"],"repository":{"url":"git@github.com:sebv/node-phantomjs-sync.git","type":"git"},"_npmVersion":"1.1.59","description":"sync version of phantom","directories":{},"maintainers":[{"name":"sebv","email":"seb.vincent@gmail.com"}],"dependencies":{"phantom":"git://github.com/sebv/phantomjs-node.git","make-sync":"0.1.x","underscore":"1.3.x"},"devDependencies":{"temp":"0.4.x","vows":"0.6.x","mocha":"1.0.x","should":"0.6.x","express":"2.5.x","ps-tree":"0.0.x","coffee-script":"1.3.x","sv-cake-utils":"0.1.x"},"_id":"phantom-sync@0.1.2","version":"0.1.2"}