Skip to content

Cheatsheet:Definition

Ulric Wilfred edited this page Feb 7, 2015 · 8 revisions

Channel Type

Rpd.channeltype(<id>, <Object | Function⇒Object>);

(all properties are optional, except name or alias, one of them is required)

  • name : String — inlet & outlet — full name
  • alias : String — inlet & outlet — short alias for transfer purpose
  • default : Any — inlet & outlet — default value
  • readonly : boolean — inlet — is editable by user (true by default)
  • accept : Function(Any)boolean — inlet — accept or decline a value
  • adapt : Function(Any)Any — inlet & outlet — adapt a value before passing
  • show : Function(Any)string — inlet & outlet — show value to a user
  • tune : Function(KefirStream)KefirStream — inlet — tune up updates stream

Node Type

Rpd.nodetype(<id>, <Object | Function⇒Object>);

(all properties are optional)

  • name : String — full name
  • width : Float — specify if the node should be wider or narrower than normal node (a relative value to normal size)
  • inlets : Object(alias: Object)
    • type : <id> — type of the channel
    • default : Any — default value
    • hidden : boolean — is hidden or not (false by default)
    • readonly : boolean — is editable by user (false by default, but works only if channel readonly property also set to false)
    • cold : boolean — if true, updates are not triggered with this inlet, but its value is stored (false by default)
  • outlets : Object(alias: Object)
    • type : <id> — type of the channel
  • tune: Function(KefirStream)KefirStream — tune up updates stream
  • process : Function(Object(alias: Any)[, Object(alias: Any)])Object(alias: Any) — get inlets values and return outlet values; called on every inlet update, expect for "cold" ones
  • handle: Object(event-id: Function) — subscribe to specific events

Node Description

Rpd.nodedescription(<id>, String);

Describe a node type this way, optionally. It is a placeholder for future l10n.

Channel type descriptions are also planned in 2.0 or at some point

Channel Renderer

Rpd.channelrenderer(<id>, <render-type>, <Object | Function⇒Object>);

(all properties are optional)

  • show : Function(DOMElement, Any[, Any]) — gets element, value and, in case of inlet, a value representation (as channel.show returned), may modify the value box, passed as the first argument;
  • edit : Function(DOMElement, Inlet, KefirStream)KefirStream — gets value element to modify for editing and a stream of incoming values, should return a stream of outgoing values

Node Renderer

Rpd.noderenderer(<id>, <render-type>, <Object | Function⇒Object>);

(all properties are optional)

  • first : Function(DOMElement)Object(alias: Object)|None — prepare node body for rendering, optionally return inlets subscriptions:
    • default : Function()Any — if defined, called when inlet should be set to default value, should return it
    • valueOut : KefirStream — if defined, inlet is subscribed to receive values from given stream
  • always : Function(DOMElement, Object(alias: Any), Object(alias: Any)) — render node body using inlets and outlets values, called on every inlet update (including hidden ones)
Clone this wiki locally