Code Monkey home page Code Monkey logo

Comments (7)

jfarcand avatar jfarcand commented on May 20, 2024

I like it. Will add it now. Do you have a sample you can share so I can test?

from atmosphere.

jfarcand avatar jfarcand commented on May 20, 2024

So the new code will looks like

       invokeCallback: function(response) {
        var call = function (index, func) {
            func(response);
        };


        if (typeof(jQuery.atmosphere.request.callback) == 'function') {
            jQuery.atmosphere.request.callback(response);
        } else {
            jQuery.atmosphere.log(logLevel, ["Invoking " + jQuery.atmosphere.callbacks.length + " callbacks"]);
            if (jQuery.atmosphere.callbacks.length > 0) {
                jQuery.each(jQuery.atmosphere.callbacks, call);
            }
        }
    }

Is that OK?

from atmosphere.

mjeanroy avatar mjeanroy commented on May 20, 2024

Yes, this is the idea.

But maybe, "jQuery.atmosphere.callbacks" schould be call even if "jQuery.atmosphere.request.callback" is defined.
With this, you can define one callback per request and "global" callbacks for all request. I don't know if it is the best choice, but I think it can be usefull to have "global" callbacks.

How I fixed it :

invokeCallback: function(response) {
    var call = function (index, func) {
        func(response);
    };

    // Invoke global callbacks
    jQuery.atmosphere.log(logLevel, ["Invoking " + jQuery.atmosphere.callbacks.length + " callbacks"]);
    if (jQuery.atmosphere.callbacks.length > 0) {
        jQuery.each(jQuery.atmosphere.callbacks, call);
    }
    // Invoke request callback
    if (typeof(jQuery.atmosphere.request.callback) == 'function') {
        jQuery.atmosphere.request.callback(response);
    }
}

I can write a sample you can test, where can I send it to you ?

from atmosphere.

jfarcand avatar jfarcand commented on May 20, 2024

Make a lot of sence. Use [email protected]

Thanks a lot!

from atmosphere.

jfarcand avatar jfarcand commented on May 20, 2024

OK I've integrated it with a basic test. Still highly interested to a simple sample if you have a chance. Thanks a lot.

from atmosphere.

mjeanroy avatar mjeanroy commented on May 20, 2024

I just sent you my sample at [email protected].
Thanks!

from atmosphere.

jfarcand avatar jfarcand commented on May 20, 2024

Works like a charm!!!

Thanks!

from atmosphere.

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.