Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Client-side Helpers Within PhantomJS #133

Open
iansinnott opened this issue Jun 12, 2014 · 1 comment
Open

Adding Client-side Helpers Within PhantomJS #133

iansinnott opened this issue Jun 12, 2014 · 1 comment

Comments

@iansinnott
Copy link

There doesn't seem to be a good way to hook into PhantomJS and add custom code. Maybe this could be accomplished by adding an onInitialized callback to the PhantomJS instance. This would be a huge improvement and would probably solve quite a few of the open issues here.

For anyone who needs to include helpers on the client side now, you can just put them in your client-side meteor code:

// client/helpers/phantom_helpers.js
if (window.callPhantom) {
  domHelper = function() {
    return 'stuff...';
  };
}

This is still ugly since all test code should really go under tests/, not client/, but it's a quick workaround until there is better method.

@ghost
Copy link

ghost commented Jun 18, 2014

There is way you can keep your helpers in tests/ but it's a little messy.

I just toString all of my helpers, passed it as a parameter to evalSync and then eval on the other side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant