I have been designing a Process Class for PowerSDK in order to add control over execution of long or short running functions in a predictable manner. The concept is to provide a class that handles most of the mundane loop logic so the functions are simpler and easier to manage long term. This is similar to how the quicksort works in Flash as the sortTest is a functional argument on a generic quicksort implementation.
Below are a simple set of cases that describes the types of functionality I want to cover.
Cases or "different ways to execute a BackFlip..."
1. Iterate - Execute a function a certain number of times
"Do 10 Backflips"
"Do 1 Backflip for every letter"
"Do 3 Backflips for every user"
2. Interval - Execute a function after an amount of time/frames
"Do a Backflip every minute"
"Do 3 Backflips per hour"
"Do 2 Backflips every 3rd frame"
3. Event - Execute a function when this happens
"Do a Backflip when this happens"
"Do 2 Backflips every 3rd time this happens"
4. Alarm - Execute a function at this time
"Do a Backflip at 10 AM daily"
"Do 3 Backflips at 12 noon Monday Weekly"
5. Alarm Range - Execute a function repeatedly across a time range
"Do Backflips from 10:13AM to 10:20AM daily"
6. While - Execute a function while this is true
"Do Backflips until this is true"
Creating a process
myProcess = new PSDK.Process( function, arguments, cycle )
function - (function) pass a function
arguments - (array) pass static or dynamic arguments. Dynamic arguments are eval'd at execution.
cycle - (object) pass the pass a function
Start and Stop a process
myProcess.start()
myProcess.stop()
Events
myProcess.onStart
myProcess.onStop
myProcess.onCycleStart
myProcess.onCycleEnd
Getter/Setter
myProcess.setCycle(cycleObject)
myProcess.setFunction(myFunction)
We will see where this leads....
Cheers,
ted ;)
DIGG IT! 
0 Responses to “ PowerSDK Process Class ”
Post a Comment