Login
Artifact [b9f4fa9522]
Login

Artifact b9f4fa9522544d88268e038e39960d1b2fd27cb3:


/**
  A demonstration widget which outputs the server-reported time.
*/
$function(){
    // argv.0 === the widget's name
    // argv.1 === the rendering options. Frameworks always passes an Object if the client does not.

    // Set defaults for options client did not provide:
    const opt = this.extendProperties(object{
        localTime: false,
        timeFormat: "%Y-%m-%d %H:%M:%S",
        tzLabel: false
    }, argv.1 )

    // Generate the output:
    opt.label && $this.out opt.label ' '
    $this.out strftime(opt.timeFormat, -1, opt.localTime)
    opt.tzLabel && $this.out opt.localTime ? ' local' : ' UTC'

}.apply api.cgi api.cgi.renderWidget.renderArgs