Rev 1604 | Rev 1625 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1604 | Rev 1608 | ||
|---|---|---|---|
| Line 38... | Line 38... | ||
| 38 | Timer::Timers Timer::timers_; |
38 | Timer::Timers Timer::timers_; |
| 39 | 39 | ||
| 40 | Timer::Timer() |
40 | Timer::Timer() |
| 41 | { |
41 | { |
| 42 | this->name_ = "timer"; |
42 | this->name_ = "timer"; |
| 43 | - | ||
| 44 | this->ImportFunction("Timer_OnTimeout"); |
- | |
| 45 | 43 | ||
| 46 | this->ExportFunction("StartTimer", Timer::Export_StartTimer); |
44 | this->ExportFunction("StartTimer", Timer::Export_StartTimer); |
| 47 | this->ExportFunction("ClearTimer", Timer::Export_ClearTimer); |
45 | this->ExportFunction("ClearTimer", Timer::Export_ClearTimer); |
| 48 | } |
46 | } |
| 49 | 47 | ||
| 50 | Timer::~Timer() |
48 | Timer::~Timer() |
| 51 | { |
49 | { |
| 52 | 50 | ||
| 53 | } |
51 | } |
| 54 | 52 | ||
| 55 | void Timer::InitializeDone() |
53 | void Timer::InitializeDone() |
| 56 | { |
54 | { |
| 57 |
|
55 | Plugin::InitializeDone(); |
| - | 56 | ||
| - | 57 | this->ImportFunction("Timer_OnTimeout"); |
|
| 58 | 58 | ||
| 59 | timer::Manager::Instance()->ConnectSlots(timer::Manager::SignalOnTimeout::slot_type(&Timer::SlotOnTimeout, this, _1, _2).track(this->tracker_)); |
59 | timer::Manager::Instance()->ConnectSlots(timer::Manager::SignalOnTimeout::slot_type(&Timer::SlotOnTimeout, this, _1, _2).track(this->tracker_)); |
| 60 | } |
60 | } |
| 61 | 61 | ||
| 62 | void Timer::SlotOnTimeout(timer::TimerId timer_id, bool repeat) |
62 | void Timer::SlotOnTimeout(timer::TimerId timer_id, bool repeat) |
| Line 73... | Line 73... | ||
| 73 | 73 | ||
| 74 | ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList); |
74 | ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList); |
| 75 | arguments->push_back(v8::Integer::New(timer_id)); |
75 | arguments->push_back(v8::Integer::New(timer_id)); |
| 76 | arguments->push_back(v8::Boolean::New(repeat)); |
76 | arguments->push_back(v8::Boolean::New(repeat)); |
| 77 | 77 | ||
| 78 | this->Call( |
78 | this->Call( timer_id, "Timer_OnTimeout",arguments); |
| 79 | } |
79 | } |
| 80 | 80 | ||
| 81 | Value Timer::Export_StartTimer(const v8::Arguments& args) |
81 | Value Timer::Export_StartTimer(const v8::Arguments& args) |
| 82 | { |
82 | { |
| 83 | LOG.Debug(std::string(__FUNCTION__) + " called!"); |
83 | LOG.Debug(std::string(__FUNCTION__) + " called!"); |