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

PageInfo method to get parent position #262

Merged
merged 2 commits into from
Oct 1, 2015
Merged

PageInfo method to get parent position #262

merged 2 commits into from
Oct 1, 2015

Conversation

pomartel
Copy link
Contributor

Here is my pull request for issue #260.

It mimics the Facebook canvas methods. Let me know if it looks about right. You call the getPageInfo from the content window with a callback. The message is sent to the parent which makes the calculations and send a message back to the content window. Then the callback is invoked.

I didn't write any tests or documentation yet but I will if you wish to merge it to your repo.

@davidjbradshaw
Copy link
Owner

Hey that looks great. Would love it if you could add some Jasmine tests and docs.

My one comment is that after it has been triggered, should the parent page start listening for scroll events and update the callback in the iFrame.

@pomartel
Copy link
Contributor Author

Ok, I added some docs but I have no idea how to test this since it's a two way call. The iframe pings the parent who sends back information. I looked at different tests you made but could not find any that would be a good baseline. If you have any idea on how this could be done or an example you could point me to, let me know.

As for listening to scroll events, my concern is that many different events can change the page infos. Scroll is one, resizing the browser is another, resizing the iframe, moving the iframe, etc. I'm afraid it could get messy trying to catch all the scenarios that would trigger an update and that's why calling the method when needed seems more appropriate in my opinion.

davidjbradshaw added a commit that referenced this pull request Oct 1, 2015
davidjbradshaw added a commit that referenced this pull request Oct 1, 2015
davidjbradshaw added a commit that referenced this pull request Oct 1, 2015
davidjbradshaw added a commit that referenced this pull request Oct 1, 2015
davidjbradshaw added a commit that referenced this pull request Oct 1, 2015
davidjbradshaw added a commit that referenced this pull request Oct 1, 2015
@davidjbradshaw
Copy link
Owner

Thanks for this, I've fixed the jsHint errors and added morked tests for both scripts. Will release in next version.

davidjbradshaw added a commit that referenced this pull request Oct 1, 2015
@davidjbradshaw davidjbradshaw merged commit 7b2d843 into davidjbradshaw:master Oct 1, 2015
@pomartel
Copy link
Contributor Author

pomartel commented Oct 2, 2015

Great, thanks!

@davidjbradshaw
Copy link
Owner

Just updated this on the dev branch, so that the callback gets recalled on parent scroll and resize events.

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

Successfully merging this pull request may close these issues.

2 participants