0

Suppose I want to build someone similar to an alarm, except every hour it performs a list of tasks. For the sake of this example, suppose it is to send notifications. I want the inner function to look something like this:

$scope.performTasks = function(){
    emailUserWeb();
    emailUserPhone();
    postToFacebook();
    postToTwitter();
    postToWherever();
}

So, assume everyday, this sends a notification at exactly ##:37pm. If I want something like this to run even when I am not on the site, how can I build something like that? Is it even possible?

2 Answers2

1

Your Javascript is client-sided. That means it can only be executed as long as it is executed by the client's browser.

If you want to execute scheduled tasks, you need a server that runs the code (e.g., NodeJS).

matfax
  • 634
  • 11
  • 17
0

You can build it as Chrome App/Extension which will have a backgroud process, If you keep Chrome running, even if not on the app webpage, it will work.

Check: https://developer.chrome.com/extensions/background_pages

napolux
  • 15,574
  • 9
  • 51
  • 70