RHO DecodeEvent Not Working with JS Closures

I'm unable to get doScan() to fire when I point the decodeEvent to a method in my application closure.

Here is a test that you can use (place in the head of your doc):

    <script src="/js/jquery-1.6.4.min.js"></script>

   

    <script> 

    window.MYAPP = {

        init: function()

        {

            scanner.start();

        },

       

        doScan: function(json)

        {

            alert(json.data);

        }

    };

   

    $(document).ready(function() {

        MYAPP.init();

    });

    </script>

       

    <!--RhoElements Tags-->

    <meta http-equiv="scanner" content="aimType:presentation">

    <meta http-equiv="scanner" content="enable">

    <meta http-equiv="scanner" Content="DecodeEvent:url('javascript:window.MYAPP.doScan(%json);')">


Am I doing something wrong here? How can I get doScan to fire?

Robert Galvin
JoshuaUnfortunately we do not

Joshua

Unfortunately we do not currently support closures when you reference a function for our javascript objects. You would have to pull it out into a standard function.

Connected by DROID on Verizon Wireless

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Joshua McGinnis
Gotcha. In case anyone wants

Gotcha. In case anyone wants to know a workaround, I was able to solve this issue by adding a global doScan that delegates the scan data to my closure.

    <script> 

    window.MYAPP = {

        init: function()

        {

            scanner.start();

        },

       

        doScan: function(json)

        {

            alert(json.data);

        }

    };

   

    function doScan(json)

    {

        MYAPP.doScan(json);

    }

   

    $(document).ready(function() {

        MYAPP.init();

    });

    </script>

       

    <!--RhoElements Tags-->

    <meta http-equiv="scanner" content="aimType:presentation">

    <meta http-equiv="scanner" content="enable">

    <meta http-equiv="scanner" Content="DecodeEvent:url('javascript:doScan(%json);')">

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


James Morley-Smith
You beat me to it, Joshua...

You beat me to it, Joshua....definitely 'like' that response

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments