Skip to content

Conversation

CleverSJX
Copy link

场景

js调用native的一个定时器,同步返回一个定时器id,js在不需要这个定时器的时候可以用这个id让native关闭这个定时器,达到节省资源的目的

        var $t1 =  $('#time1');
        var time1Index = 0;
        var time1 = dsBridge.call("timer",{isOnce:false,time:3},function(res){
            time1Index++;
            $t1.html('第一个定时器执行'+time1Index+'次')
            if(time1Index >= 4){
                dsBridge.call("stopTimer",time1)
            }
        });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant