简体   繁体   中英

Typeahead.js remote call restriction

I am using Twitter's Typeahead.js with around 15 remote calls. In the example below, part of my code is given with the names "list1" and "list2". My actual codes goes till list15 from list1.

                  {
                    name: "list1",
                    remote: "/get-list1/%QUERY",
                    template: "<p><strong>{{value}}</strong> - {{extract}}</p>",
                    engine: Hogan,
                    maxParallelRequests : 15                         
                  },
                  {
                    name: "list2",
                    remote: "/get-list2/%QUERY",
                    template: "<p><strong>{{value}}</strong></p>",
                    engine: Hogan,
                    maxParallelRequests : 15                         
                  },

The code works without any issues. But only remote calls are made only for the first 6 datums and the rest are ignored. When I did some reading, I came to know that there is a default limit of maximum number of remote calls (maxParallelRequests).

maxParallelRequests – The max number of parallel requests typeahead.js can 
                      have pending. Defaults to 6.

As seen in the above code, I have set the maxParallelRequests value to 15, but still it executes only 6 remote calls.

Is my method of providing the setting wrong? Please correct me what I am missing.

I believe you need to be specifying maxParallelRequests in a remote object, at least according to the docs.

{
                name: "list1",
                remote: {
                   url: "/get-list1/%QUERY",
                   maxParallelRequests: 15
                },
                template: "<p><strong>{{value}}</strong> - {{extract}}</p>",
                engine: Hogan
}

typeahead.bundle.js file in setting

maxPendingRequests = 6

change:

maxPendingRequests = 16

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM