Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js异步调用native方法时,同时支持同步返回数据 #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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