mozilla / qbrt

CLI to a Gecko desktop app runtime
Apache License 2.0
390 stars 31 forks source link

Enhance shell app with index.html #95

Closed hankchiutw closed 7 years ago

hankchiutw commented 7 years ago

Just clone the repo and execute qbrt run shell to have a hello world page.

mykmelez commented 7 years ago

Thanks for the contribution! I'm curious about how this differs from qbrt run example, which seems to do the same thing. I wonder if there's a way for the shell app to provide a different experience. Alternately, perhaps we don't need the example app with these changes to the shell?

hankchiutw commented 7 years ago

I think the benefit of using shell app is you can define some XUL specified features. And the question would be: what kind of features are XUL limited?(i.e. can not be implemented by js, html, jsm). But, I doubt how many developers are interested in XUL development. lol.

mykmelez commented 7 years ago

I think the benefit of using shell app is you can define some XUL specified features. And the question would be: what kind of features are XUL limited?(i.e. can not be implemented by js, html, jsm). But, I doubt how many developers are interested in XUL development. lol.

Indeed, there may not be very many developers who are interested in building XUL apps. But it could still be valuable to demonstrate one. How about creating an examples/ directory and putting a new XUL app into it, calling it something like examples/hello-world-xul/? Then we could move the example/ directory to examples/hello-world-html/ and use the two directories to compare an HTML app to a XUL one!

(The reason I suggest a separate app, instead of reusing the shell app, is that the shell app is used internally to implement running/packaging of a URL, so I'd like to avoid including code in it that is just for demonstration purposes.)

hankchiutw commented 7 years ago

Understand. I update a commit, please have a look!

hankchiutw commented 7 years ago

how about this?

mykmelez commented 7 years ago

how about this?

It looks good! Two small nits, which I'll fix when merging:

  1. According to the XUL tutorial, "You cannot embed text directly into a XUL file without tags around it and expect it to be displayed. You can use two XUL elements for this purpose." Strangely, the "Hello, World!" text in index.xul does get displayed. But it'd be more correct to use a <label> element.
  2. Empty elements in XUL like <script src="app.js"></script> are generally written as an empty-element tag (a.k.a. the "self-closing syntax"), i.e. <script src="app.js"/>.
mykmelez commented 7 years ago

Merged with those changes. Great work, thanks @hankchiutw!

Note: I'd be happy to see more example apps in the examples/ directory, as well as new features in the existing example apps. So if there's something you're interested in demonstrating, feel free to propose and/or implement it!

(For the "hello-world" apps, as I mentioned before, it would be ideal if the two apps had equivalent features, so it's possible to compare the implementation in HTML to the implementation in XUL. For other example apps, however, there's no need to implement two different versions. A single app, whether HTML or XUL, is just fine.)

hankchiutw commented 7 years ago

Thanks! Looking forward to seeing the project growing up!