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

Unable to get render view in GetWindowObject #2

Closed
skibz opened this issue Sep 20, 2014 · 5 comments
Closed

Unable to get render view in GetWindowObject #2

skibz opened this issue Sep 20, 2014 · 5 comments

Comments

@skibz
Copy link

skibz commented Sep 20, 2014

i'm not sure if this bug is only to do with linux.
i'm running on ubuntu 12.04

i'll poke around in the source and see if i can figure it out :)

@skibz
Copy link
Author

skibz commented Sep 20, 2014

okay, so decided to start again by cloning the repo, running npm install, then npm start and then executing the correct binary for my platform (linux64 in this case)

this caused the notifications to work properly, /however/, a blank and unclosable notification stays in the bottom right of the screen. also, if you create a lot of notifications, say, more than ten, the app throws the Unable to get render view in GetWindowObject error, again.

@edjafarov
Copy link
Owner

I am still working on the notifications.
Sad but so far I stumbled on things I can't fix.
After I thought everything is fine and I was happy about everything goes well and I started to implement it in my app I found out that each time window notification is opening app's window gets focus :trollface: WTF!
So later I started to open 5-6 windows pool and reuse them so that Window.show() never get called. Though there is another problem - in mac we have several desktops. And if I am not calling Window.show() the notification is shown only on desktop where the app is. Making notification completely useless :( I guess same issue will be in Ubuntu.
I am still have Idea to fix it in node-webkit project. If original app won't have a focus - It would work!

Unable to get render view in GetWindowObject means that window is not opened yet and you are trying to get window object frominside.

As an outcome - It works perfectly on windows. Native html5 is awful there thus this module is better to use. Mac and linux - native html5 is ok. Until node-webkit will allow to show windows without focusing original app.

@adam-lynch
Copy link

Got the same error on Windows; #6

@dpac4u
Copy link

dpac4u commented Dec 7, 2014

this there any solution available for this. Thanks un advance. I am struggling for this.

@skibz skibz closed this as completed Feb 18, 2015
@aretias-kr
Copy link

It can be fixed to use this code.

        freeWin.on('loaded', function () {
            Emitter(this.window);

            freeWin.window.document.body.onclick = function () {
                freeWin.window.emit("body.click");
            };

            freeWin.window.document.body.oncontextmenu = function () {
                freeWin.window.emit("contextmenu");
            };

            // on<stuff> events implementation
            noti.on('body.click', function () {
                if (noti.onclick) noti.onclick.call(noti);
            }.bind(noti));
            noti.on('show', function () {
                if (noti.onshow) noti.onshow.call(noti);
            }.bind(noti));
            noti.on('error', function () {
                if (noti.onerror) noti.onerror.call(noti);
            }.bind(noti));
            noti.on('close', function () {
                if (noti.onclose) noti.onclose.call(noti);
            }.bind(noti));
            noti.on('contextmenu', function () {
                if (noti.oncontextmenu) noti.oncontextmenu.call(noti);
            }.bind(noti));

            winPool.push(freeWin);
            freeWin.isBusy = true;
            freeWin.originalHtml = freeWin.window.document.body.innerHTML;

            this.resizeTo(noti.options.width, noti.options.height);
            this.moveTo(rightBorder() + 10, getNextAvailTop());

            noti.show();
        });

Add window.emit("event") code on Window loaded.
and remove those emit code from HTML like this.
As-is:

<body onclick="window.emit('body.click')" oncontextmenu="window.emit('contextmenu');">

To-be:

<body>

May be my code is little difference with yours
Cause, I customize getFreeWin method to don't use 6 Cached window.
But, the context is same.

I hope it's helpful

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

5 participants