{"id":18304584,"url":"https://github.com/numtel/phantomjs-persistent-server","last_synced_at":"2025-04-05T15:31:21.394Z","repository":{"id":21645275,"uuid":"24965977","full_name":"numtel/phantomjs-persistent-server","owner":"numtel","description":"PhantomJS Persistent Server Meteor Package","archived":false,"fork":false,"pushed_at":"2015-09-13T22:04:26.000Z","size":245,"stargazers_count":8,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T06:41:24.473Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numtel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-08T23:53:51.000Z","updated_at":"2016-06-02T19:27:03.000Z","dependencies_parsed_at":"2022-08-21T20:40:45.498Z","dependency_job_id":null,"html_url":"https://github.com/numtel/phantomjs-persistent-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtel%2Fphantomjs-persistent-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtel%2Fphantomjs-persistent-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtel%2Fphantomjs-persistent-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtel%2Fphantomjs-persistent-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numtel","download_url":"https://codeload.github.com/numtel/phantomjs-persistent-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247358653,"owners_count":20926266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T15:29:27.919Z","updated_at":"2025-04-05T15:31:20.568Z","avatar_url":"https://github.com/numtel.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PhantomJS Persistent Server Meteor Package\n\nSynchronously spawn a PhantomJS instance then pass functions to its context\nfor execution.\n\n[![Build Status](https://travis-ci.org/numtel/phantomjs-persistent-server.svg?branch=master)](https://travis-ci.org/numtel/phantomjs-persistent-server)\n\n\n## Installation\n\n```bash\n$ meteor add numtel:phantomjs-persistent-server\n```\n\n## Implements\n\n#### phantomLaunch({...})\n\nLaunch a PhantomJS instance that can listen for requests. If PhantomJS is \ninstalled, the installed version will be used. If not available, the\npackage `gadicohen:phantomjs` will be used.\n\n**Options:**\n\nKey    | Type |Description\n-------|------|------------------------------------------------------\n`port` | Integer | Port to run PhantomJS server, leave unspecified for any open port\n`forcePort` | Boolean | Kill PhantomJS if currently using port\n`debug` | Boolean | Forward PhantomJS stdout as well as other debug info\n\n*Notes:* \n\n* When using an automatically selected port, automatic code pushes will result in orphaned PhantomJS processes that will exist until the Meteor server closes.\n* If specifying a port, `forcePort` must be set to `true` for automatic code pushes to restart the PhantomJS server.\n\n**Returns:** Function for executing methods.\n\n    phantomLaunch() -\u003e function(func, args...)\n\nThe first argument, `func` (function), is copied as a string to the PhantomJS\nserver. This means that it is not included in the context of the surrounding\ncode but within the PhantomJS context. All parameters must be passed in as\nJSON-serializable objects in the following arguments and no external functions\nmay be called.\n\nThe returned function also contains the following properties and methods:\n```javascript\nvar phantomExec = phantomLaunch();\nconsole.log(phantomExec.port) // Print port number\nphantomExec.kill() // Kill server (will not kill orphaned processes)\n```\n\n## Example in CoffeeScript\n\nLoad Google.com and print the page title.\n\n```coffee\nif Meteor.isServer\n  # Launch PhantomJS server and wait for the server to be ready.\n  phantomExec = phantomLaunch()\n\n  # Define a function that will be copied to the server by string and executed\n  # in the PhantomJS context. Its arguments include the arguments passed as\n  # well as a callback function in the normal style (error, result).\n  titleTest = (url, callback) -\u003e\n    webpage = require 'webpage'\n    page = webpage.create()\n    page.open url, (status) -\u003e\n      if status == 'fail'\n        callback 'load-failure'\n      else\n        title = page.evaluate ()-\u003e\n          return document.title\n        callback undefined, title\n\n  # Perform the request.\n  result = phantomExec titleTest, 'http://google.com/'\n  console.log result # Print 'Google'\n```\n\n## Run Tests\n\n```bash\n$ git clone https://github.com/numtel/phantomjs-persistent-server.git\n$ cd phantomjs-persistent-server\n$ meteor test-packages ./\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtel%2Fphantomjs-persistent-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumtel%2Fphantomjs-persistent-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtel%2Fphantomjs-persistent-server/lists"}