Skip to content

Problem with send to worker under Firefix but not Chrome #3

Open
@zsimpson

Description

@zsimpson

The following code executes perfectly under Chrome but acts like the second call to "send" to the worker thread fails under Firefox.

main_thread

<html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.js"></script>
<script src="/javascripts/jquery.hive.js"></script>
<script type="text/javascript">
    var frameComplete = true;

    $(document).ready( function() {
        startThread();
        runOneFrame();
    });

    function startThread() {
        // DELETE the old thread
        // PROBLEM: Acting like this isn't doing anything
        $.Hive.destroy();
        
        // LAUNCH a new thread
        $.Hive.create({
            count: 1,
            worker: '/javascripts/play_worker_test.js',
            receive: function (data) {
                if( data.cmd == "done" ) {
                    console.log( "recvd frame complete" );
                    frameComplete = true;
                }
            },  
        });

        $.Hive.get(0).send( "go" );

        frameComplete = true;
    }
        
        
    function runOneFrame() {
        if( frameComplete ) {
            if( $.Hive.get(0) ) {
                console.log( "sending frame start" );
                $.Hive.get(0).send( "go" );
                frameComplete = false;
            }
        }
        setTimeout( runOneFrame, 1 );
    }

</script>

</html>

worker

importScripts('/javascripts/jquery.hive.pollen.js');

$(function( data ) {
    for( var i=0; i<1000000000; i++ ) {
    }
    $.send( { "cmd":"done" } );
});


Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions