How to use 'javascript alert object properties' in JavaScript

Every line of 'javascript alert object properties' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
90function alertsObj(name) {
91 if (!validObjName(name)) {return;}
92
93 //create a reference object that can be inherited
94 var me = Object(this);
95
96 //declare the object's properties
97 this.name = name;
98 this.data = { timestamp: [],
99 message: [] };
100
101 this.displayInDiv = false;
102 this.divId = null;
103
104 //declare the object's methods
105 this.add = function(message) {
106 me.data.timestamp.push(new Date(new Date().getTime()));
107 me.data.message.push(message);
108
109 //if progress window is open, then display latest alerts in window
110 if(me.displayInDiv) {
111 $(me.divId).append(me.data.message.length + ") " + me.data.message[me.data.message.length-1] + "<br />");
112 }
113
114 console.log(message); //display message in output console
115 };
116
117 this.drop = function() {
118 storageAPI.dropTable([me.name]);
119 };
120
121 //execute object's initialisation actions
122 $(me.divId).empty(); //empty the div
123}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code


Related snippets