Skip to content

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

Open
CleverSJX wants to merge 1 commit intowendux:masterfrom
CleverSJX:master
Open

js异步调用native方法时,同时支持同步返回数据#174
CleverSJX wants to merge 1 commit intowendux:masterfrom
CleverSJX:master

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