What can I use for packaged apps instead of alert?

971 views
Skip to first unread message

Juan de Dios Becerra

unread,
Sep 25, 2013, 12:55:39 PM9/25/13
to chromi...@chromium.org
I understand that several APIs have been disabled for packaged apps in Chrome, one of them is alerts, what can I use instead of that? 

If I have to redirect this question to other place please let me know where can be.

Brandon Nozaki Miller

unread,
Sep 25, 2013, 1:00:42 PM9/25/13
to Juan de Dios Becerra, Chromium Apps
I recommend rolling your own dialog box. or using system notifications.


On Wed, Sep 25, 2013 at 9:55 AM, Juan de Dios Becerra <j.bece...@gmail.com> wrote:
I understand that several APIs have been disabled for packaged apps in Chrome, one of them is alerts, what can I use instead of that? 

If I have to redirect this question to other place please let me know where can be.

--
You received this message because you are subscribed to the Google Groups "Chromium Apps" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-app...@chromium.org.
To post to this group, send email to chromi...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-apps/.
For more options, visit https://groups.google.com/a/chromium.org/groups/opt_out.

PhistucK

unread,
Sep 25, 2013, 1:01:15 PM9/25/13
to Juan de Dios Becerra, Chromium Apps
Whatever you want, be creative. :)
For example, you can create a position: fixed <div> with the text you want to show and a <button type="button">OK</button> that will display: none it.

Of course, if you are looking for alert() due to its synchronous nature, you are out of luck and will have to callbacks and the like.


PhistucK


On Wed, Sep 25, 2013 at 7:55 PM, Juan de Dios Becerra <j.bece...@gmail.com> wrote:
I understand that several APIs have been disabled for packaged apps in Chrome, one of them is alerts, what can I use instead of that? 

If I have to redirect this question to other place please let me know where can be.

--

Fady Samuel

unread,
Sep 25, 2013, 1:11:32 PM9/25/13
to PhistucK, Juan de Dios Becerra, Chromium Apps
We are currently experimenting with supporting a Dialog API in <webview>. Basically, you'd call alert from within your guest content, that would block the guest, and you'd get a dialog event in the embedder which you can use to display custom UI, and eventually unblock the guest content. This is not yet on the stable channel though, as it needs some more work.

Fady

Brandon Nozaki Miller

unread,
Sep 25, 2013, 1:18:07 PM9/25/13
to Fady Samuel, PhistucK, Juan de Dios Becerra, Chromium Apps
that sounds awesome.

David Brodbeck

unread,
Sep 25, 2013, 2:49:27 PM9/25/13
to Chromium Apps
I'm using the dialog widget in JQuery UI.


On Wed, Sep 25, 2013 at 9:55 AM, Juan de Dios Becerra <j.bece...@gmail.com> wrote:
I understand that several APIs have been disabled for packaged apps in Chrome, one of them is alerts, what can I use instead of that? 

If I have to redirect this question to other place please let me know where can be.

--
You received this message because you are subscribed to the Google Groups "Chromium Apps" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-app...@chromium.org.
To post to this group, send email to chromi...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-apps/.
For more options, visit https://groups.google.com/a/chromium.org/groups/opt_out.



--
GPG Key Fingerprint: 0DB7 4B50 8910 DBC5 B510 79C4 3970 2BC3 2078 D875

Brandon Nozaki Miller

unread,
Sep 25, 2013, 3:29:32 PM9/25/13
to David Brodbeck, Chromium Apps
JQuery in packaged apps makes my eyes rain.
http://www.youtube.com/watch?v=qIxHb7cA6tg&feature=youtu.be&t=11s

I always found jQuery to be nice because of the sizzle selectors but now that I use querySelector and querySelectorAll, I find very little use for it, especially utilizing the calc() function in CSS3 for sizes and the transition rule in CSS3 for animations. Nothing wrong with jQuery, just know every time you use it unnecessarily in a packaged app a native JS fairy goes blind in one eye. Really the only thing to be gained with native I suppose is about a 600x performance increase in the code execution, however that really isn't noticeable in most apps I suppose.

-Brandon

David Brodbeck

unread,
Sep 25, 2013, 4:35:30 PM9/25/13
to Brandon Nozaki Miller, Chromium Apps
On Wed, Sep 25, 2013 at 12:29 PM, Brandon Nozaki Miller <bra...@1942design.com> wrote:
JQuery in packaged apps makes my eyes rain.
http://www.youtube.com/watch?v=qIxHb7cA6tg&feature=youtu.be&t=11s

I always found jQuery to be nice because of the sizzle selectors but now that I use querySelector and querySelectorAll, I find very little use for it, especially utilizing the calc() function in CSS3 for sizes and the transition rule in CSS3 for animations. Nothing wrong with jQuery, just know every time you use it unnecessarily in a packaged app a native JS fairy goes blind in one eye. Really the only thing to be gained with native I suppose is about a 600x performance increase in the code execution, however that really isn't noticeable in most apps I suppose.

Certainly it's up to personal taste.  In situations that aren't performance-critical I prefer not to reinvent the wheel; I'd rather spend my time putting my app together than writing and debugging dialog box routines and typing 'getElementById' over and over. It's always possible to substitute native code in performance-critical sections. YMMV. ;)

Brandon Nozaki Miller

unread,
Sep 25, 2013, 4:46:34 PM9/25/13
to David Brodbeck, Chromium Apps
Agreed. Its all opinion when not performance critical.

querySelector and querySelectorAll in case you did not know it accept the same parameters as the sizzle selectors in jQuery so you don't have to keep writing getElementById. you could even get fancy about not wanting to type and do $=document.querySelectorAll.

Then do $('my > crazy[target="hi"]'); Certainly not the same as a jQuery object, but just for anyone who didn't know and may want to play around with performance. you can test this stuff out at JSperf.com as well if you are really interested in performance.

Doing lots of Mobile HTML5 apps and having to defeat clients low expectations of HTML5 hybrid performance, I try to encourage developers to learn about JS performance as they will without a doubt someday be representing HTML5 in a mobile environment. Many devs don't know how much slower jQuery is than vanilla JS. most operations range from 600x to 6000x slower in jQuery which is fine on most desktops, but not on lower powered machines, tablets, or mobile devices.

Joe Marini

unread,
Sep 25, 2013, 5:20:41 PM9/25/13
to Brandon Nozaki Miller, David Brodbeck, Chromium Apps
We recently landed support for <dialog> in M31 Canary. I should have a sample posted soon that shows how to use it in Chrome Apps.



--
You received this message because you are subscribed to the Google Groups "Chromium Apps" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-app...@chromium.org.
To post to this group, send email to chromi...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-apps/.
For more options, visit https://groups.google.com/a/chromium.org/groups/opt_out.



--
Joe Marini
Developer Advocate / Chrome

Juan de Dios Becerra

unread,
Sep 26, 2013, 9:53:16 AM9/26/13
to chromi...@chromium.org, Brandon Nozaki Miller, David Brodbeck
Could you please maintain us informed? there is a estimated date?

Joe Marini

unread,
Sep 26, 2013, 12:33:43 PM9/26/13
to Juan de Dios Becerra, Chromium Apps, Brandon Nozaki Miller, David Brodbeck
Given Chrome's approximate 6-week shipping cycle, I would look for M31 sometime in November. 

Joe Marini

unread,
Sep 26, 2013, 12:47:03 PM9/26/13
to PhistucK, Chromium Apps, Orville, Brandon Nozaki Miller, Juan de Dios Becerra

I'll find out the details on that.

On Sep 26, 2013 9:39 AM, "PhistucK" <phis...@gmail.com> wrote:
I believe it is guarded by a command line flag, so you do not expect this to work for the public even when it reaches a stable version (in its current incarnation).


PhistucK

PhistucK

unread,
Sep 26, 2013, 12:38:58 PM9/26/13
to Joe Marini, Juan de Dios Becerra, Chromium Apps, Brandon Nozaki Miller, David Brodbeck
I believe it is guarded by a command line flag, so you do not expect this to work for the public even when it reaches a stable version (in its current incarnation).


PhistucK


On Thu, Sep 26, 2013 at 7:33 PM, Joe Marini <joem...@google.com> wrote:

Vincent Scheib

unread,
Sep 27, 2013, 5:49:56 PM9/27/13
to Joe Marini, PhistucK, Chromium Apps, Orville, Brandon Nozaki Miller, Juan de Dios Becerra
dialog is behind flag: enable-experimental-web-platform-features. Here's a link to cut'n'paste
chrome://flags/#enable-experimental-web-platform-features

Josh Haughton

unread,
Nov 10, 2017, 1:43:30 PM11/10/17
to Chromium-Apps-Announce
You can make your own synchronous alert/prompt using "async function" "await" and "$.when().done()" to suspend the code until the user responds. I found this useful if you are porting over an app where you can't break the function up into different sections very easily. This does requires the jQuery library. 

Reply all
Reply to author
Forward
0 new messages