Java Script Basics
[1] Calling a function of another file from your javascript file
file 01: graphinventor.js
=================
console.log("-----------------------------------------Time Unit ");
console.log("Previous Time Stamp ");
var test123 = function (data){
console.log("-----------------------------------------inside test123 ");
console.log(data)
alert("This is an alert" +data);
}
file 02: gadgetconf.js
===============
processData: function(data) {
console.log('data '+JSON.stringify(data));
// in console of the browser (Ctrl+c) you see the content now as json data
console.log("------------------------");
test123(data);
console.log("------------------------");
}
main.js file (Loading graphinventor.js file first)
==========
<!-- Custom -->
<script src="js/graphinventor.js"></script>
<script src="js/gadgetconf.js"></script>
<script src="js/main.js"></script>
[2] Callback function is a function passed into another function.
No comments:
Post a Comment