PublicShow sourcejquery.pl -- Call jQuery on the SWISH interface

Select objects in the SWISH interface using jQuery, run an arbitrary JavaScript function on them and return the result. This predicate was introduced while adding functionality to request the contents of tabs in the SWISH interface.

Source jquery(+Selector, +Function) is det
Source jquery(+Selector, +Function, -Reply) is det
Run a jQuery query in the SWISH interface. Selector defines the receiver of the jQuery method, Function is the JavaScript function to run on the receiver and Reply is the Prolog representation of the result.
Arguments:
Selector- selects the jQuery receiver. It takes three forms:
  • If the selector is a string, it is simply interpreted as $(Selector).
  • If the selector is a compound, the functor defines the start point. If a (single) argument provided it is handed to the jQuery find method. Defines starting points are:
    this
    The current SWISH runner object, jQuery class prologRunner.
    cell
    The current notebook (query) cell. jQuery class nbCell.
    notebook
    The current notebook. jQuery class notebook
    swish
    The SWISH instance. jQuery class swish.
Function- is a compound term representing a JavaScript call. The functor name is used as method and the remaining arguments are converted by json_write_dict/2.
Reply- is the JavaScript reply, converted to Prolog by the Pengine.stringify() method.