()
| 4623 | } |
| 4624 | |
| 4625 | function FlashRuntime() { |
| 4626 | var pool = {}, |
| 4627 | clients = {}, |
| 4628 | destroy = this.destroy, |
| 4629 | me = this, |
| 4630 | jsreciver = Base.guid('webuploader_'); |
| 4631 | |
| 4632 | Runtime.apply( me, arguments ); |
| 4633 | me.type = type; |
| 4634 | |
| 4635 | |
| 4636 | // 这个方法的调用者,实际上是RuntimeClient |
| 4637 | me.exec = function( comp, fn/*, args...*/ ) { |
| 4638 | var client = this, |
| 4639 | uid = client.uid, |
| 4640 | args = Base.slice( arguments, 2 ), |
| 4641 | instance; |
| 4642 | |
| 4643 | clients[ uid ] = client; |
| 4644 | |
| 4645 | if ( components[ comp ] ) { |
| 4646 | if ( !pool[ uid ] ) { |
| 4647 | pool[ uid ] = new components[ comp ]( client, me ); |
| 4648 | } |
| 4649 | |
| 4650 | instance = pool[ uid ]; |
| 4651 | |
| 4652 | if ( instance[ fn ] ) { |
| 4653 | return instance[ fn ].apply( instance, args ); |
| 4654 | } |
| 4655 | } |
| 4656 | |
| 4657 | return me.flashExec.apply( client, arguments ); |
| 4658 | }; |
| 4659 | |
| 4660 | function handler( evt, obj ) { |
| 4661 | var type = evt.type || evt, |
| 4662 | parts, uid; |
| 4663 | |
| 4664 | parts = type.split('::'); |
| 4665 | uid = parts[ 0 ]; |
| 4666 | type = parts[ 1 ]; |
| 4667 | |
| 4668 | // console.log.apply( console, arguments ); |
| 4669 | |
| 4670 | if ( type === 'Ready' && uid === me.uid ) { |
| 4671 | me.trigger('ready'); |
| 4672 | } else if ( clients[ uid ] ) { |
| 4673 | clients[ uid ].trigger( type.toLowerCase(), evt, obj ); |
| 4674 | } |
| 4675 | |
| 4676 | // Base.log( evt, obj ); |
| 4677 | } |
| 4678 | |
| 4679 | // flash的接受器。 |
| 4680 | window[ jsreciver ] = function() { |
| 4681 | var args = arguments; |
| 4682 |
nothing calls this directly
no outgoing calls
no test coverage detected