How do I make a background process?

  • 0
    Good afternoon
    I'm interested in this question.
    I use WP, but this is not very useful information and does not really matter here.
    Node is not used in this project.
    There is a task to make some background process in javascript
    This process includes a function that constantly performs certain operations.
    In simple terms, we have a page, upon entering which, javascript is activated which performs certain actions constantly while someone is on this page.
    But you need to make sure that this script is executed constantly without the participation of direct users.
    that is, you need to start it once and not touch it again.
    Thanks in advance for your reply
    JavaScript Anonymous, Feb 27, 2019

  • 3 Answers
  • 0
    Web Worker?
    Anonymous

  • 0
    What does the script do? Modifies the base via the API? Changing the page? Displaying notifications?

    Is it permissible for every person who has visited the site to execute this script?

    Here is the phrase
    In simple terms, we have a page, when visiting which javascript is activated, which performs certain actions constantly while someone is on this page.

    But you need to make sure that this script is executed constantly without the participation of users directly


    Very controversial. Should the script be executed upon entering the page or without user intervention?



    So read about the webworker, but keep in mind that this is also a client javascript, and it runs in the user's browser.

    https://developer.mozilla.org/en-US/docs / Web / API / W ...



    Well, if you need the ability to update, for example, the catalog of goods by pushing from the server and provide offline work, you can look at

    https://developer.mozilla.org/en-US/docs/Web / API / S ...
    Anonymous

  • 0
    It is standard practice to start a timer. Once in how many milliseconds there it will do something. You can spy on Yandex metrics, they litter the entire debugging area
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!