Preview in node webkit?

  • I know this has been brought up before, but now that we have file operations in the node webkit plugin, it's more relevant now. For those of us wanting to make a game that uses node WebKit's file io, it's very inconvenient to have to export every time we want to preview. I thought I had an idea how to work around the problem, by exporting a node webkit 'game' that was set to do one thing, go to the preview URL on the start of layout.

    At first, I thought that worked great - previewing that way in node webkit works just like chrome, when pressing preview in c2 updates the node webkit window. But then I realized that the node webkit code wasn't working - it wasn't reading or writing files to disk. I looked at the preview source and it seems like the node webkit plugin is a disabled in preview.

    Is there anything that could be done about this? Perhaps something simple like adding node webkit to the list of browsers to preview with? Or a way to make the method I described above work? It would make things much, much easier to be able to preview with one click rather than have to export every time we want to test our code.

  • That would be very helpful to be able to preview in node webkit

  • Literally... what if C++ developers have to compile and test, then re-compile and test again?

  • I looked in to this, and node-webkit's user-agent string by default looks exactly the same as Chrome's, and I didn't want to add detection based on a common global variable name ("require"). So for the next build I've made a change where you can just add "nw" to the query string, and it forces it to detect as node-webkit. i.e. just visit localhost instead and it should enable all node-webkit features. (Obviously don't do this from a browser, since it will just throw javascript errors when it hits the node-webkit specific code.)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • thanks for this :)

    can't wait for next stable release to try all the new features

  • Nice, thanks Ashley!

  • This might sound silly, but how do you actually test node in preview now with the new beta version?

    I learned quickly that attempting from the browser was a no no. I also downloaded node-webkit itself, but I guess I am using it just like a browser and get the same javascript error.

    So how does someone actually go about testing their game without having to export. I searched and was unable to find a tutorial as of yet either.

    Also, exporting my game as node does yield the correct results. I do get my text file in the user directory with the correct content in it. But I do not know how to actually make this happen with preview.

    Thank you

  • You can change the preview browser/mode if you click on the project title and then select "Preview Browser" > Node Webkit

  • You can change the preview browser/mode if you click on the project title and then select "Preview Browser" > Node WebkitYeah, that feature was added after this thread was created.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)