greensock/GreenSock-JS — pull request #56 by davestewart (2014-07-04 17:02:45+00:00)
Title: Added defaultScope functionality

Added defaultScope functionality, as per this forum post:

http://forums.greensock.com/topic/9938-default-scope-for-events-and-callbacks/

Demo code:

```javascript
Test = function()
{
// callbacks
var props =
{
defaultScope :this,
onStart :this.onStart,
onUpdate :this.onUpdate,
onComplete :this.onComplete,
onReverseComplete :this.onReverseComplete
}

// animation
this.tl = new TimelineMax(props);
this.tl
.to(this, 0.2, {value:1})
.call(this.callback)
.addPause(0.2, this.onPause);

// resume after pause by moving mouse
$('body')
.one('mousemove', $.proxy(this.resume, this) );
}

Test.prototype =
{
// properties
tl :null,
value :0,

// events
onStart:function()
{
console.log('start: ', this);
},

onPause:function()
{
console.log('pause: ', this);
console.log('move mouse to resume animation...');
},

onComplete:function()
{
console.log('complete: ', this);
},

onReverseComplete:function()
{
console.log('reverse complete: ', this);
},

onUpdate:function()
{
console.log('update: ', this.value);
},

// callbacks
resume:function()
{
this.tl.reverse();
},

callback:function()
{
console.log('callback: ', this);
}

}

console.clear();
new Test();
```

Output:
```
Test

start: Test {tl: TimelineMax, _gsTweenID: "t64", value: 0, onStart: function, onPause: function…}

update: 0
update: 0.2603999999996832
update: 0.37589999999978807
update: 0.4743750000000495
update: 0.5643999999998919
update: 0.6459749999997646
update: 0.7243749999998448
update: 0.7884000000000189
update: 0.8439749999999245
update: 0.8943749999999704
update: 0.9323999999999161
update: 0.9619750000000027
update: 0.9843750000000142
update: 0.996399999999993

callback: Test {tl: TimelineMax, _gsTweenID: "t64", value: 1, onStart: function, onPause: function…}

pause: Test {tl: TimelineMax, _gsTweenID: "t64", value: 1, onStart: function, onPause: function…}

move mouse to resume animation...

update: 1
update: 0.9957750000000151
update: 0.9817750000000178
update: 0.9600000000000728
update: 0.9271000000000712
update: 0.8877750000001661
update: 0.8359750000001602
update: 0.7791000000000278
update: 0.7137750000001557
update: 0.6400000000003138
update: 0.5511000000002834
update: 0.45240000000023894
update: 0.35197499999998905
update: 0.24310000000018994
update: 0.12577500000042097
update: 0

reverse complete: Test {tl: TimelineMax, _gsTweenID: "t64", value: 0, onStart: function, onPause: function…}
```