Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
6d86fc16
Commit
6d86fc16
authored
13 years ago
by
mcmlxxix
Browse files
Options
Downloads
Patches
Plain Diff
execute events with optional context/arguments
parent
c20c9d01
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/event-timer.js
+8
-4
8 additions, 4 deletions
exec/load/event-timer.js
with
8 additions
and
4 deletions
exec/load/event-timer.js
+
8
−
4
View file @
6d86fc16
...
...
@@ -57,13 +57,13 @@ function Timer() {
}
/* create a new event, do not include () on action parameter */
this
.
addEvent
=
function
(
interval
,
repeat
,
action
)
{
var
event
=
new
Event
(
interval
,
repeat
,
action
);
this
.
addEvent
=
function
(
interval
,
repeat
,
action
,
arguments
,
context
)
{
var
event
=
new
Event
(
interval
,
repeat
,
action
,
arguments
,
context
);
this
.
events
.
push
(
event
);
}
/* event object created by addEvent */
function
Event
(
interval
,
repeat
,
action
)
{
function
Event
(
interval
,
repeat
,
action
,
arguments
,
context
)
{
/* last time_t at which event was executed */
this
.
lastrun
=
time
();
/* seconds between event occurance */
...
...
@@ -72,9 +72,13 @@ function Timer() {
this
.
repeat
=
repeat
;
/* function called when event is run */
this
.
action
=
action
;
/* arguments passed to function */
this
.
arguments
=
arguments
;
/* context in which to run function */
this
.
context
=
context
;
/* run event */
this
.
run
=
function
()
{
this
.
action
(
);
this
.
action
.
apply
(
this
.
context
,
this
.
arguments
);
this
.
lastrun
=
time
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment