quark-shell-mac
quark-shell-mac copied to clipboard
Support multiple new windows
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.
@codewise-nicolas: we can do mw.newWindow("WindowID");
and mw.close("WindowID");
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.
Here is a diff.patch instead https://gist.github.com/codewise-nicolas/913916afefe4a763e6db