{"action":"created","issue":{"url":"https://api.github.com/repos/amir20/phantomjs-node/issues/417","repository_url":"https://api.github.com/repos/amir20/phantomjs-node","labels_url":"https://api.github.com/repos/amir20/phantomjs-node/issues/417/labels{/name}","comments_url":"https://api.github.com/repos/amir20/phantomjs-node/issues/417/comments","events_url":"https://api.github.com/repos/amir20/phantomjs-node/issues/417/events","html_url":"https://github.com/amir20/phantomjs-node/issues/417","id":141533334,"number":417,"title":"Multiple property notifications","user":{"login":"rscreene","id":1532373,"avatar_url":"https://avatars.githubusercontent.com/u/1532373?v=3","gravatar_id":"","url":"https://api.github.com/users/rscreene","html_url":"https://github.com/rscreene","followers_url":"https://api.github.com/users/rscreene/followers","following_url":"https://api.github.com/users/rscreene/following{/other_user}","gists_url":"https://api.github.com/users/rscreene/gists{/gist_id}","starred_url":"https://api.github.com/users/rscreene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rscreene/subscriptions","organizations_url":"https://api.github.com/users/rscreene/orgs","repos_url":"https://api.github.com/users/rscreene/repos","events_url":"https://api.github.com/users/rscreene/events{/privacy}","received_events_url":"https://api.github.com/users/rscreene/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-17T09:57:27Z","updated_at":"2016-03-17T15:08:46Z","closed_at":null,"body":"### Expected behavior\r\n\r\nI have the following code:\r\n```\r\nphantom.create().then(function (myPh) {\r\n  ph = myPh;\r\n  return ph.createPage();\r\n}).then(function (myPage) {\r\n  page = myPage;\r\n\r\n  outObj = ph.createOutObject();\r\n\r\n  return page.property(\"onResourceRequested\", function (requestData, networkRequest, out) {\r\n    console.log(\"--URL\", requestData.url);\r\n    out.url = requestData.url;\r\n  }, outObj);\r\n}).then(function (status) {\r\n  return page.open(\"https://yahoo.com\");\r\n}).then(function (status) {\r\n\r\n  outObj.property('url').then(function (url) {\r\n    console.log(\"++URL=\", url);\r\n  });\r\n});\r\n```\r\n\r\nI would like the outObj.property function to be executed every time the onResourceRequested callback is invoked.\r\n\r\n### Actual behavior\r\n\r\nThe outObj.property function is executed just the once.  Presumably because the promise has been satisfied.  Is there something I'm missing that will allow me to have the function called repeatedly (or have I made a mistake in the code!).  I tried to create a new promise in the handler but this feels wrong and just seems to repeat the function for the same URL!\r\n\r\nOutput extract:\r\n```\r\n...\r\ninfo: --URL https://geo.query.yahoo.com/v1/public/yql?yhlVer=2&yhlClient=rapid&yhlS=2023392312&yhlCT=2&yhlBTMS=1458208550151&yhlClientVer=3.29.1&yhlRnd=xwLQjuutmTimntIg&yhlCompressed=3\r\ninfo: ----------------PROPERTY [object Object]\r\n++URL= https://geo.query.yahoo.com/v1/public/yql?yhlVer=2&yhlClient=rapid&yhlS=2023392312&yhlCT=2&yhlBTMS=1458208550151&yhlClientVer=3.29.1&yhlRnd=xwLQjuutmTimntIg&yhlCompressed=3\r\ninfo: --URL https://uk.yahoo.com/_td_api/resource/today/id/today;ids=%5B%22id-1021577%22%2C%22id-1021554%22%2C%22id-1021553%22%2C%22id-1021552%22%2C%22id-1021542%22%5D;startIndex=45;ui=%7B%22viewer_off_network%22%3Atrue%2C%22viewer%22%3Afalse%2C%22pcsExclusions%22%3Afalse%7D?_appletType=today&_p=p1&authed=0&bucket=903&crumb=&default_appletinit=viewport&default_page=p1&device=desktop&enable_dd=&guid=&lang=en-GB&locdrop_crumb=&mcCrumb=&region=GB&rid=75vdkolbekvp4&site=fp&ssl=1&ucsCrumb=&woeid=44418\r\ninfo: --URL https://geo.query.yahoo.com/v1/public/yql?yhlVer=2&yhlClient=rapid&yhlS=2023392312&yhlCT=2&yhlBTMS=1458208550574&yhlClientVer=3.29.1&yhlRnd=rhBX67F060zi0s1C&yhlCompressed=3\r\ninfo: --URL https://s.yimg.com/zz/combo?kx/yucs/uh3s/uh/414/js/uh-min.js&kx/yucs/uh2/common/145/js/jsonp-super-cached-min.js&kx/yucs/uh3s/uh/379/js/escregex-min.js&kx/yucs/uh3s/uh/376/js/persistence-min.js&kx/yucs/uh3s/uh/401/js/menu_group_plugin-min.js&kx/yucs/uh3s/uh/430/js/menu-plugin-min.js&kx/yucs/uh3s/uh/429/js/menu_handler_v2-min.js&kx/yucs/uh3s/uh/376/js/gallery-jsonp-min.js&kx/yucs/uh3s/uh/408/js/logo_debug-min.js&kx/yucs/uh3/uh/js/958/localeDateFormat-min.js&kx/yucs/uh3s/uh/409/js/timestamp_library-min.js&kx/yucs/uh3s/uh/376/js/usermenu_v2-min.js&kx/yucs/uh3/signout-link/10/js/signout-min.js&kx/yucs/uhc/rapid/49/js/uh_rapid-min.js&kx/yucs/uhc/meta/66/js/meta-min.js&kx/yucs/uh3/disclaimer/388/js/disclaimer_seed-min.js&kx/yucs/uh3s/top-bar/137/js/top_bar_v2-min.js&kx/yucs/uh3s/top-bar/139/js/home_menu-min.js&kx/yucs/uh3s/search/369/js/search-min.js\r\ninfo: --URL https://s.yimg.com/dh/ap/default/140317/pc_flags_sprite_0317_Regular_630pm.png\r\n...\r\n```\r\n\r\n### Environment\r\n\r\n- OS: OSX 10.10\r\n- Node version (`node -v`): v0.12.0\r\n- package version: 2.0.6\r\n"},"comment":{"url":"https://api.github.com/repos/amir20/phantomjs-node/issues/comments/197925145","html_url":"https://github.com/amir20/phantomjs-node/issues/417#issuecomment-197925145","issue_url":"https://api.github.com/repos/amir20/phantomjs-node/issues/417","id":197925145,"user":{"login":"amir20","id":260667,"avatar_url":"https://avatars.githubusercontent.com/u/260667?v=3","gravatar_id":"","url":"https://api.github.com/users/amir20","html_url":"https://github.com/amir20","followers_url":"https://api.github.com/users/amir20/followers","following_url":"https://api.github.com/users/amir20/following{/other_user}","gists_url":"https://api.github.com/users/amir20/gists{/gist_id}","starred_url":"https://api.github.com/users/amir20/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amir20/subscriptions","organizations_url":"https://api.github.com/users/amir20/orgs","repos_url":"https://api.github.com/users/amir20/repos","events_url":"https://api.github.com/users/amir20/events{/privacy}","received_events_url":"https://api.github.com/users/amir20/received_events","type":"User","site_admin":false},"created_at":"2016-03-17T15:08:46Z","updated_at":"2016-03-17T15:08:46Z","body":"That is not possible with this module. The communication is not bidirectional. Only node can ask for things from phantomjs. I don't think the documentation suggests you can do that? \r\n\r\nYou could try doing a different thing. It sounds like you are trying to collect all URLs. Use an array instead and collect all the URLs in `out`. Something like `out.urls.push(requestData.url)`. \r\n\r\nDoing things like this is cleaner. "}}