MCPcopy Create free account
hub / github.com/TruthHun/BookStack / FlashRuntime

Function FlashRuntime

static/webuploader/webuploader.js:7604–7683  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7602 }
7603
7604 function FlashRuntime() {
7605 var pool = {},
7606 clients = {},
7607 destroy = this.destroy,
7608 me = this,
7609 jsreciver = Base.guid('webuploader_');
7610
7611 Runtime.apply( me, arguments );
7612 me.type = type;
7613
7614
7615 // 这个方法的调用者,实际上是RuntimeClient
7616 me.exec = function( comp, fn/*, args...*/ ) {
7617 var client = this,
7618 uid = client.uid,
7619 args = Base.slice( arguments, 2 ),
7620 instance;
7621
7622 clients[ uid ] = client;
7623
7624 if ( components[ comp ] ) {
7625 if ( !pool[ uid ] ) {
7626 pool[ uid ] = new components[ comp ]( client, me );
7627 }
7628
7629 instance = pool[ uid ];
7630
7631 if ( instance[ fn ] ) {
7632 return instance[ fn ].apply( instance, args );
7633 }
7634 }
7635
7636 return me.flashExec.apply( client, arguments );
7637 };
7638
7639 function handler( evt, obj ) {
7640 var type = evt.type || evt,
7641 parts, uid;
7642
7643 parts = type.split('::');
7644 uid = parts[ 0 ];
7645 type = parts[ 1 ];
7646
7647 // console.log.apply( console, arguments );
7648
7649 if ( type === 'Ready' && uid === me.uid ) {
7650 me.trigger('ready');
7651 } else if ( clients[ uid ] ) {
7652 clients[ uid ].trigger( type.toLowerCase(), evt, obj );
7653 }
7654
7655 // Base.log( evt, obj );
7656 }
7657
7658 // flash的接受器。
7659 window[ jsreciver ] = function() {
7660 var args = arguments;
7661

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected