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

Support multiple new windows #18

Open
xhacker opened this issue Sep 4, 2014 · 4 comments
Open

Support multiple new windows #18

xhacker opened this issue Sep 4, 2014 · 4 comments
Labels

Comments

@xhacker
Copy link
Member

xhacker commented Sep 4, 2014

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/4206266-support-multiple-new-windows?utm_campaign=plugin&utm_content=tracker%2F899498&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F899498&utm_medium=issues&utm_source=github).
@xhacker xhacker added the feature label Sep 4, 2014
@xhacker xhacker self-assigned this Sep 22, 2014
@xhacker xhacker mentioned this issue Nov 14, 2014
@codewise-nicolas
Copy link

With this in mind, how do you envision the mw.close() function to work when multiple windows are at work ?

Do you want to pass some sort of id ?
var newWindowId = mw.newWindow();
var newWindowId2 = mw.newWindow();

mw.close(newWindowId);
mw.close(newWindowId2);

Ive managed to make the code popup 2 windows (just two variables with some simple logic), my next attemtp will be to use an array (or list) to keep track of the LDYWebViewWindowController windows.

@xhacker
Copy link
Member Author

xhacker commented Nov 14, 2014

@codewise-nicolas: we can do mw.newWindow("WindowID"); and mw.close("WindowID");

@codewise-nicolas
Copy link

Here is what I have so far, please excuse me as its my first work with objective-c.
It works great with no errors.
File LDYWebViewDelegate.m https://gist.github.com/codewise-nicolas/fb4f03f238d5015f0160
File LDYWebViewDelegate.h https://gist.github.com/codewise-nicolas/038a77c3f6103747e53a
File LDYWebViewWindowController.m https://gist.github.com/codewise-nicolas/dff930d42b9f02c0df1c
File LDYWebViewWindowController.h https://gist.github.com/codewise-nicolas/90d1e6644ee8cc9a8bc5

Apologoes for the gists, I will try and get a proper git repo going locally to track changes.

I store the webview into a NSMutableDictionary. The key is "name" parameter passed into the function call, mw.newWindow({name: 'a name'}), and mw.closeWindow({name: 'a name'});
I also updated the newWindow code so that if the window name already exists, then it doesnt re-instantiate but shows it (and goes to the url provided)
Also added code to trap the close event from the new window so we can remove it from the dictionary.

@codewise-nicolas
Copy link

Here is a diff.patch instead
https://gist.github.com/codewise-nicolas/913916afefe4a763e6db

@xhacker xhacker removed their assignment Jul 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants