Exemplo n.º 1
0
 Stream.prototype._load = function (cfg) {
     cfg = cfg || {};
     var that = this;
     return client.ajax(this.url, {
         data: {
             'StreamQuery[filters]': that.$.data('filters'),
             'StreamQuery[sort]': cfg.sort,
             'StreamQuery[from]': cfg.from,
             'StreamQuery[limit]': cfg.limit,
             'StreamQuery[contentId]': cfg.contentId,
             'StreamQuery[suppressionsOnly]': cfg.suppressionsOnly
         }
     });
 };
    StreamRequest.prototype._send = function () {
        var stream = this.stream;

        if (stream.currentXhr) {
            stream.currentXhr.abort();
        }

        return client.ajax(this.url, {data:  this.getRequestData(), beforeSend: function (xhr) {
            stream.currentXhr = xhr;
        }}).then(function(response) {
            stream.currentXhr = undefined;
            return response;
        });
    };