2022-08-21 19:10:42 +08:00
|
|
|
#
|
|
|
|
# Aerotow Everywhere - Add-on for FlightGear
|
|
|
|
#
|
|
|
|
# Written and developer by Roman Ludwicki (PlayeRom, SP-ROM)
|
|
|
|
#
|
|
|
|
# Copyright (C) 2022 Roman Ludwicki
|
|
|
|
#
|
|
|
|
# Aerotow Everywhere is an Open Source project and it is licensed
|
|
|
|
# under the GNU Public License v3 (GPLv3)
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
2022-08-21 19:20:13 +08:00
|
|
|
# Class Timer for wrapping maketimer() function.
|
2022-08-21 19:10:42 +08:00
|
|
|
#
|
|
|
|
var Timer = {
|
|
|
|
#
|
|
|
|
# Constructor
|
|
|
|
#
|
|
|
|
new: func () {
|
|
|
|
return { parents: [Timer] };
|
|
|
|
},
|
|
|
|
|
|
|
|
#
|
|
|
|
# Run timer as single shot
|
|
|
|
#
|
|
|
|
# delaySec - Delay in seconds for execute timer's callback.
|
|
|
|
# self - Specifying what any "me" references in the function being called will refer to.
|
|
|
|
# callback - Function to be called after given delay.
|
|
|
|
#
|
|
|
|
# Return timer handler object
|
|
|
|
#
|
|
|
|
singleShot: func (delaySec, self, callback) {
|
|
|
|
var timer = maketimer(delaySec, self, func () {
|
|
|
|
callback();
|
|
|
|
});
|
|
|
|
timer.singleShot = 1;
|
|
|
|
timer.start();
|
|
|
|
|
|
|
|
return timer;
|
|
|
|
},
|
|
|
|
};
|