Giter VIP home page Giter VIP logo

Comments (8)

Lision avatar Lision commented on May 18, 2024

Emmmmm... 为什么会有这种需求呢?

from wkwebviewjavascriptbridge.

sunsang avatar sunsang commented on May 18, 2024

看了一下源码,是在第一次回调后,就从 responseCallbacks 数组删除了这个回调,导致第二次回调找不到回调的方法。
请问可以把这行放开吗? 会有什么问题,或者有更好的方案

image

from wkwebviewjavascriptbridge.

Lision avatar Lision commented on May 18, 2024
  • 理论上 js 的回调执行之后,js 完全可以自己定时调用 func;
  • 如果 js 多次执行,我理解 1 对 1 的调用和回调也可以满足。
    以上,所以我不太清楚哪些场景会产生这种需求。

from wkwebviewjavascriptbridge.

sunsang avatar sunsang commented on May 18, 2024

Emmmmm... 为什么会有这种需求呢?

比如两个回调的状态不一样,可能第一次回调是complate的状态,第二次回调是success的状态

from wkwebviewjavascriptbridge.

Lision avatar Lision commented on May 18, 2024

我理解你的需求类似于一个 stream 的形式,你需要 subscribe 另一方的执行状态,本质上是一个观察者模式?
如果我的理解没错的话,感觉是不是可以让 native 在执行状态变化的时候主动调用 js 代码来通知到 js 呢?

from wkwebviewjavascriptbridge.

sunsang avatar sunsang commented on May 18, 2024

我理解你的需求类似于一个 stream 的形式,你需要 subscribe 另一方的执行状态,本质上是一个观察者模式?
如果我的理解没错的话,感觉是不是可以让 native 在执行状态变化的时候主动调用 js 代码来通知到 js 呢?

from wkwebviewjavascriptbridge.

sunsang avatar sunsang commented on May 18, 2024

我理解你的需求类似于一个 stream 的形式,你需要 subscribe 另一方的执行状态,本质上是一个观察者模式?
如果我的理解没错的话,感觉是不是可以让 native 在执行状态变化的时候主动调用 js 代码来通知到 js 呢?

差不多是这个意思,可以像你说的这样。就是看有没有更好的方案,想利用这个callBack这个回调不知道行不行?删除那一行,会有问题吗?

from wkwebviewjavascriptbridge.

Lision avatar Lision commented on May 18, 2024

会导致存放回调的数据结构积累越来越多的回调 block。

from wkwebviewjavascriptbridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.