jexm's repositories
hashlink
A virtual machine for Haxe
helloGirl_andord
helloGirl_andord
b-site
soft-forking from openbilibili/go-common
NekoTimer
package; class NekoTimer { private static var threadActive:Bool = false; private static var timersList:Array<TimerInfo> = new Array<TimerInfo>(); private static var timerInterval:Float = 0.1; public static function addTimer(interval:Int, callMethod:Void->Void):Int { //setup timer thread if not yet active if (!threadActive) setupTimerThread(); //add the given timer return timersList.push(new TimerInfo(interval, callMethod, Sys.time() * 1000)) - 1; } public static function delTimer(id:Int):Void { timersList.splice(id, 1); } private static function setupTimerThread():Void { threadActive = true; neko.vm.Thread.create(function() { while (true) { Sys.sleep(timerInterval); for (timer in timersList) { if (Sys.time() * 1000 - timer.lastCallTimestamp >= timer.interval) { timer.callMethod(); timer.lastCallTimestamp = Sys.time() * 1000; } } } }); } } private class TimerInfo { public var interval:Int; public var callMethod:Void->Void; public var lastCallTimestamp:Float; public function new(interval:Int, callMethod:Void->Void, lastCallTimestamp:Float) { this.interval = interval; this.callMethod = callMethod; this.lastCallTimestamp = lastCallTimestamp; } }
NekoTimer.hx
ddd
openbili-go-commom
听说这是来自 https://github.com/openbilibili/go-common/ 的 “哔哩哔哩 bilibili 网站后台工程 源码”,不过咱也不知道这是啥。
openbilibili
https://github.com/openbilibili/go-common 备份(反正是啥咱也不知道,咱也不敢问)
send_mail_for_neko22
jexm.ma