Git Product home page Git Product logo

meteor-waitonserver's Introduction

๐ŸŽต Now Playing ๐ŸŽต

Now Playing

meteor-waitonserver's People

Contributors

curtislarson avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

rosamson ibet7o

meteor-waitonserver's Issues

new suggestion for some result cache

Hi again @quackware,
New version works well but I have a suggestion and I'm glad to know your opinion.
I guess it's better to store and retrieve data based on method name and input parameters because often many method calls with same input have a same result and this is better to getResponse from client (cache result for repetitive method call) and don't call server method again. It's also possible to add new parameter to waitOnServer for it's situation.

For example like below for force re call server method and clear data after we retrieve it with getResponse:

Util.waitOnServer("postByTitle", this.title(), this.language(), this.id(), { forceReCallServerMethod: true });

And like below for prevent new call and retrieve previous result from d_waitOns array in getResponse (if it's available) and prevent clear result for future call:

Util.waitOnServer("postByTitle", this.title(), this.language(), this.id(), { forceReCallServerMethod: false });

And like this for getResponse:

var data = this.d_waitOns[name + args].data;
var forceReCallServerMethod = this.d_waitOns[name + args].forceReCallServerMethod;
if (forceReCallServerMethod) {
    this.d_waitOns[name + args] = {};
    return data;
}
else {
 return data;
}

exception when using with ms-seo package

Hi,
When I used ms-seo package I got bellow exception on client (firebug):

Exception in delivering result of invoking 'mymethod': Util.waitOnServer/callback@http://localhost:3000/client/utils.js?92b62c7658f435f94a973fdd2c4b275196768eb5:28:9

This is my code:

HomeController = RouteController.extend({
    action: function () {
        this.render('home', {
            data: {
                result: Util.getResponse("myMethod")
            }
        });
    },
    waitOn: function () {
        return Util.waitOnServer("myMethod");
    },
    onAfterAction: function() {
        if (!Meteor.isClient) {
            return;
        }
        console.log(JSON.stringify(SEO));
        SEO.set({
            title: "Sitename - Home",
            meta: {
                'description': "My Description HERE",
            },
            og: {
                'title': "Sitename - Home",
                'description': "My Description HERE"
            }
        });
    }
});

getResponse() always return first result

Hi again @quackware ,
I found a small bug in multiple arguments mode.

If client call a server method many times with different argument getResponse always return first call result. I think this is because of getResponse function. Because this is always get result based on server method name.
For example:

Router.route('/post/:title', { name: "postByTitle" });

PostByTitleController = RouteController.extend({
    title: function(){
        var title = this.params.title;
        return title;
    },
    action: function () {
        this.render('postByTitle', {
            data: {
                listHtml: Util.getResponse("postByTitle")
            }
        });
    },
    waitOn: function () {
        return Util.waitOnServer("postByTitle", this.title());
    }
});

With this route if you fist go to /post/title_1 and then go to /post/title_2 route always render title_1 post content.

What's your idea?

It's a possible execute callback

Hi, it's a possible execute callback.

Something like the following code.

waitOn: function () {
    var router;
    router = this;

    return [
        Util.waitOnServer('campaign.load', this.campaignSlug(), function (campaignData) {
            return router.wait(Meteor.subscribe('CampaignTransactions', campaignData.id));
        }),
    ];
}

How to pass argument to method?

Hi, First thanks for your awesome tutorial and guideline for meteor method with wait but I have a small question:

How to modify your util.js to accept input argument for method??

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.