Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejavascript
themeConfluence
defaction(<parameters>) {
   <declaration0>
  ...
  <declarationN>

  <action block>
}

The parameters are a possibly empty, comma-separated list of variable names. Optional parameters can be assigned a default value. Zero or more declarations can be included to prepare data for the action block.

...

Code Block
languagejavascript
themeConfluence
send_warning = defaction(msg) {
  notify("Warning!", msg);
}

Compound actions must be enclosed in curly brackets ({...}). work the same as a rule. Suppose, for example, that in addition to putting up a notification, you wished to place the warning message in a <div/> element on the pageuse send_directive:

Code Block
languagejavascript
themeConfluence
send_warning = defaction(msg) {


  every {


    notify("Warning!", msg);

   append send_directive("#warning_div", msg)a_warning_was_given") with
      message = msg
  }
}

You can use optional parameters to modify send_warning so that it is sticky by default. (The default behavior for notify is for the notification to fade after six seconds. When the sticky parameter is true, notifications are permanent until the user closes them.)

...