JSFiddle - React, Tailwind, and code Playground

by NibblyPig

JavaScript

function SecuritySystem()
{
  var me = this;
  
  this.AlertEventCallbacks = [];
      
  this.intruderAlert = function()
      {
          for (var i=0; i < me.AlertEventCallbacks.length; i++)
          {
              me.AlertEventCallbacks[i]();
          }
      }
}

var mySystem = new SecuritySystem();

mySystem.AlertEventCallbacks.push(function() { alert('warning'); });
    
mySystem.intruderAlert();