getState

returns the reactive state object of Query

object getState();
objectstate object

Example

// returns the current state of Query
const state = $$("query").getState();

Related samples

Details

The returned state object contains the following properties and methods:

{
  value: {
    glue: "or",
    rules: [{ /*contains fields and values*/ },...]
  }
}

Properties

  • value (object) - stores all the rules and logic for filtering.

Methods

  • $observe (function) - a handler to listen to changes in the current state of Query. It takes 2 parameters:
    • prop (string) - a reactive property to listen changes of
    • handler (function) - a function to execute when changes are made. It takes the only argument:
      • value (object) - the current value of the reactive property.

For example, you can listen to the value changes as:

$$("query").getState().$observe("value", v => {
    $$("log").setValue(JSON.stringify(v, "", "\t"));
});
See also
Back to top