Class JavaScriptCallbackDisplay

  • All Implemented Interfaces:
    AutoCompletionDisplay

    public class JavaScriptCallbackDisplay
    extends Object
    implements AutoCompletionDisplay
    An auto-completion display type which invokes a JavaScript callback which is expected to return HTML, which is then used as the display. Note that the HTML is not sanitised by Funnelback so this should only be used for trusted sources. An example value might be `fetchStockPrice('some-suggestion-specific-code')` in the context of a results page which defines the following function...
    
     function fetchStockPrice(symbol) {
        // Fetch stock market data
        var data = remoteServiceCall(symbol);
        ...
    
        return data.companyName + ' (' + symbol + ') $' + data.currentPrice + ' (Higher: ' + data.hiPrice + ')';
     }
     
    • Field Detail

      • callbackCode

        @NonNull
        private @NonNull String callbackCode
    • Constructor Detail

      • JavaScriptCallbackDisplay

        public JavaScriptCallbackDisplay​(@NonNull
                                         @NonNull String callbackCode)
    • Method Detail

      • getCallbackCode

        @NonNull
        public @NonNull String getCallbackCode()
      • canEqual

        protected boolean canEqual​(Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object