Notification Alert Similar to How Stackoverflow Functions

Notification alert similar to how stackoverflow functions

Stack Overflow uses the jQuery framework, which has a method to show a hidden element using a simple animation, something like:

$('#notification-bar').show('slow');

http://api.jquery.com/show/ (check out the demos).

It is fixed to the top of the page using position:fixed in CSS:

#notification-bar { 
position:fixed;
top: 0px;
left: 0px;
width: 100%;
}

How to make a shiny or javascript alert that appears in front of other windows/apps

A better option is to use browser notification. This will trigger the browser to send out notifications in front of all windows and all other software programs. Plus, this works across all platforms, no matter what version of Windows or Linux or MacOS, as long as they have a modern browser, like Chrome, Firefox, Edge or others, it will work.

Here is how to do:

$( document ).ready(function() {
Shiny.addCustomMessageHandler('alert', function(data) {
Notification.requestPermission().then(function() {
new Notification(data.msg);
});
})
});

In your shiny server, after your process is done, add this

  session$sendCustomMessage(
type = 'alert',
message = list(
msg = "my message"
)
)

Full code:

library(shiny)

ui <- fluidPage(
tags$script(
'
$( document ).ready(function() {
Shiny.addCustomMessageHandler(\'alert\', function(data) {
Notification.requestPermission().then(function() {
new Notification(data.msg);
});
})
});
'
)
)

server <- function(input, output, session) {
observe({
# do some thing
Sys.sleep(2)
session$sendCustomMessage(
type = 'alert',
message = list(
msg = "my message"
)
)
})
}

shinyApp(ui, server)

The first time, users will be asked for permission, once they have accepted, notifications will show.

Sample Image

When it is displayed on Linux, Windows maybe a little different, but still should be above all programs.

Sample Image

Get Alert Notification when azure function returns code 200

I want to get notification when my azure function returns status 200.
I have set up Alert and I am part of Action group that's supposed to
receive alert.

I tried to create an notification alert for my function . When run my function if it returns 200 OK ,then it send me an mail notification of it.

Here are steps:

  • Created an function with http trigger and create alert from function app > Alert >Create alert and add condition and action group and email /phone details to receive an notification .

Sample Image

Here is the configurations based on your requirement

Sample Image

  • Settings inside alert in action added function :

Sample Image

  • Run my function app and returned 200 status:

Sample Image

Here is the email notifications:

Sample Image

Sample Image

For more information please refer this Blog & MS DOC .

How can i handle push notification in IMF8?

In the code snippet you have in your question there is an alert. Remove the alert snippet and no alert dialog will be displayed...

You can then put there instead anything else you'd like, like logging the notification contents, or performing any other action, like calling a function.

var notificationReceived = function(message) {
myFunction();
};

function myFunction() {
...
}


Related Topics



Leave a reply



Submit