Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1011448 // jsNotification [OLD]

JavaX fragment (include)

1  
static S jsNotification(S title, S text) {
2  
  ret hjavascript([[
3  
    if (!window.Notification) alert("Notifications not available");
4  
    else {
5  
      alert("Permission: " + Notification.permission);
6  
      if (Notification.permission !== "denied")
7  
        Notification.requestPermission(function(status) {
8  
          var n = new Notification("TITLE", { 
9  
            body: "TEXT"
10  
          }); 
11  
        });
12  
    }
13  
  ]].replace([["TITLE"]], jsQuote(title)).replace([["TEXT"]], jsQuote(text)));
14  
}

Author comment

Began life as a copy of #1008991

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1011448
Snippet name: jsNotification [OLD]
Eternal ID of this version: #1011448/4
Text MD5: 1e3ff2f3899ae73e74944c83e9543f7a
Author: stefan
Category: javax / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-26 16:17:03
Source code size: 502 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 449 / 463
Version history: 3 change(s)
Referenced in: [show references]