-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed interpretation of BattleField coordinates. Implemened monitorin…
…g angular service () for repetative service calls. Reimplemented 'BattleService.time_left()' calls using service to avoid context errors. Reimplemented 'BattleService.initiali_state()' call to avoid context errors. Done with preparations for implementing 'BattleService.processAction()' and related methods.
- Loading branch information
juraj
committed
Jun 18, 2013
1 parent
29264de
commit 22e7989
Showing
10 changed files
with
223 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
angular.module('angular-interval', []); | ||
// | ||
// Interval for angular js. | ||
// | ||
var interval = angular.module('angular-interval', []).factory("$interval", function($timeout) { | ||
|
||
// Factory base reference | ||
var intervalBase = this; | ||
|
||
// Sets a new interval action | ||
this.set = function(name, fn, interval) { | ||
intervalBase._intervals[name] = { | ||
name : name, | ||
fn : fn, | ||
interval : interval, | ||
run : true | ||
}; | ||
}; | ||
// Clears an interval action | ||
this.clear = function(name) { | ||
delete intervalBase._intervals[name]; | ||
} | ||
// Starts an interval action | ||
this.start = function(name, starting) { | ||
if (intervalBase._intervals[name]) { | ||
if (!starting) intervalBase._intervals[name].run = true; | ||
if (intervalBase._intervals[name].run) { | ||
$timeout(intervalBase._intervals[name].fn, intervalBase._intervals[name].interval) | ||
.then( function() { intervalBase.start(name, true); } ); | ||
} | ||
} | ||
} | ||
// Stops an interval action | ||
this.stop = function(name) { | ||
intervalBase._intervals[name].run = false; | ||
} | ||
|
||
// Holds references to interval actions | ||
this._intervals = { }; | ||
|
||
// Return $interval service | ||
return this; | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.