Giter VIP home page Giter VIP logo

Comments (5)

iostyle avatar iostyle commented on September 27, 2024

假如我的页面有很多弹窗,假如所有弹窗都有一个随机时间的弹出,但是我不希望这些弹窗一起弹出,当一个弹窗a触发了弹出之后,另一个弹窗b到达弹出时间也不弹出,等到a关闭时再弹出,但是a和b我事先并不知道弹出顺序,有可能a先弹出,有可能b先弹出,我使用这个库的时候,发现我没法在代码运行时,动态的去加入trigger,而是需要我事先在builder创建时候加入,这个问题是否有实现的可能

抱歉看到这个问题有点晚
首先这个项目的宗旨是连续有序的触发器,你的这个需求我建议你fork一个分支出来进行修改
建议的思路是可以在attach方法处判断当前节点不在队列内加入到队列里面即可

你先尝试一下,有问题我们再沟通

from continuoustrigger.

iostyle avatar iostyle commented on September 27, 2024

image

from continuoustrigger.

iostyle avatar iostyle commented on September 27, 2024
    //绑定执行 为Java代码提供的重载
    @Synchronized
    fun attach(id: String, strike: Trigger.Strike) {
        attach(id, strike, false)
    }

    //绑定执行
    @Synchronized
    fun attach(id: String, strike: Trigger.Strike, adjustAttach: Boolean = false) {
        if (debugMode) log("ContinuousTrigger attach ${id}")

        //阻塞唤醒
        if (tryWakeUp(id, strike)) {
            if (debugMode) log("ContinuousTrigger blockNode wakeup")
        } else if (triggerList?.isEmpty() == false) {
            triggerList?.forEach {
                if (it.id == id) {
                    it.strike = strike
                    return
                }
            }
            /**
             * 代码走到这里代表你attach的事件没有被绑定或者已经超时被跳过
             */
            if (adjustAttach)
                adjustAttach(id, strike)
        } else {
            /**
             * 代码走到这里意味着所有的事件都已经超时
             */
            if (adjustAttach)
                adjustAttach(id, strike)
        }
    }

    /**
     * 灵活绑定 内部调用用于已超时的补充或者id未注册场景
     * 外部使用的话如果不需要顺序控制则不需要注册 直接调用adjustAttach即可按需排队阻塞显示
     */
    @Synchronized
    fun adjustAttach(id: String, strike: Trigger.Strike, chokeMode: Boolean = false) {
        register(Trigger().also {
            it.id = id
            it.chokeMode = chokeMode
            it.strike = strike
        })
    }

from continuoustrigger.

iostyle avatar iostyle commented on September 27, 2024

@bigbigbig 已经更新了1.0.6版本 欢迎尝鲜

from continuoustrigger.

guominfang avatar guominfang commented on September 27, 2024

这个问题处理了吗?

需求,同时检查APP更新和数据库更新,根据接口返回,是否弹出dialog提示,如下图接入方式,代码不工作

image

from continuoustrigger.

Related Issues (3)

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.