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

Function FlashRuntime

static/webuploader/webuploader.flashonly.js:4237–4316  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4235 }
4236
4237 function FlashRuntime() {
4238 var pool = {},
4239 clients = {},
4240 destroy = this.destroy,
4241 me = this,
4242 jsreciver = Base.guid('webuploader_');
4243
4244 Runtime.apply( me, arguments );
4245 me.type = type;
4246
4247
4248 // 这个方法的调用者,实际上是RuntimeClient
4249 me.exec = function( comp, fn/*, args...*/ ) {
4250 var client = this,
4251 uid = client.uid,
4252 args = Base.slice( arguments, 2 ),
4253 instance;
4254
4255 clients[ uid ] = client;
4256
4257 if ( components[ comp ] ) {
4258 if ( !pool[ uid ] ) {
4259 pool[ uid ] = new components[ comp ]( client, me );
4260 }
4261
4262 instance = pool[ uid ];
4263
4264 if ( instance[ fn ] ) {
4265 return instance[ fn ].apply( instance, args );
4266 }
4267 }
4268
4269 return me.flashExec.apply( client, arguments );
4270 };
4271
4272 function handler( evt, obj ) {
4273 var type = evt.type || evt,
4274 parts, uid;
4275
4276 parts = type.split('::');
4277 uid = parts[ 0 ];
4278 type = parts[ 1 ];
4279
4280 // console.log.apply( console, arguments );
4281
4282 if ( type === 'Ready' && uid === me.uid ) {
4283 me.trigger('ready');
4284 } else if ( clients[ uid ] ) {
4285 clients[ uid ].trigger( type.toLowerCase(), evt, obj );
4286 }
4287
4288 // Base.log( evt, obj );
4289 }
4290
4291 // flash的接受器。
4292 window[ jsreciver ] = function() {
4293 var args = arguments;
4294

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected