Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WAKCore

Hierarchy

Index

Properties

Buffer

References the buffer constructor.

console

console: WAKConsole

References the console of the application.

Methods

ProgressIndicator

  • ProgressIndicator(numElements: Number, sessionName?: String, stoppable?: Boolean, unused?: String, name?: String): ProgressIndicator
  • Creates a progress indicator.

    Parameters

    • numElements: Number

      Number of elements to count

    • Optional sessionName: String

      Name of execution session for progress indicator

    • Optional stoppable: Boolean

      true if the progress indicator can be stopped, false otherwise

    • Optional unused: String

      Not used, always pass an empty string ("")

    • Optional name: String

      Unique name of object on the server

    Returns ProgressIndicator

generateUUID

  • generateUUID(): String
  • Creates a valid UUID string.

    generateUUID();
    // 9AE457F4B557BD7895AD4712345ABCDE

    Returns String

    Returns a string with the generated UUID

getProgressIndicator

setLogListener

  • setLogListener(moduleId: String): void
  • Defines a log listener. It calls the log() function of moduleId JS module.

    warning

    This is an enterprise feature

    warning

    Do not use console logger inside setLogListener as it will trigger cyclic logs.

    // from PROJECT/bootstrap.js
    setLogListener('log-listener');
    
    // from PROJECT/modules/log-listener/index.js
    var mail = require('waf-mail/mail');
    
    exports.log = function(logArray) {
    
        logArray.forEach(function(logObject){
    
            // logObject.level returns the log type
            // logObject.source returns in which file the log occurs
            // logObject.message returns the log message
    
            switch(logObject.level)
            {
                case 3: // DEBUG log
                case 4: // INFO log
                    // Do nothing
                    break;
                case 5: // WARNING log
                case 6: // ERROR log
                case 7: // FATAL log
                    // If error or warning log, then send an alert email to admin
                    var message = new mail.Mail();
                    message.subject = 'Test';
                    message.from = 'application@myCompany.com';
                    message.to = ['admin@myCompany.com'];
                    message.setBody( logObject.source +'/n/n'+ logObject.message );
                    mail.send({
                        address: 'smtp.gmail.com',
                        port: 465,
                        isSSL: true,
                        username: 'admin@myCompany.com',
                        password: 'my-admin-password',
                        domain: 'gmail.com'
                    }, message);
    
                    break;
                default:
                    // Do nothing
                    break;
            }
        });
    };

    Parameters

    • moduleId: String

      @param moduleId Describes the module id and path from /modules/ directory

    Returns void