Have questions? Stuck? Please check our FAQ for some common questions and answers.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

FlashService

FlashService is an Angular Factory in the Layer module with the name flash.js. It provides an API to "flash" messages on the screen. To use these functions, see the documentation on injecting Angular services.

An example of a flash message is on the Topology View:

Flash messages only appear for a short amount of time and then disappear.

NameSummary
initFlashInitialize the FlashService.
flashFlash the given message on the screen.
enableEnable or disable flash messages from showing.

Function Descriptions

initFlash

Initialize the FlashService with options. The FlashService is already initialized in onos.js, so you probably won't have to call this function.

Example UsageArgumentsReturn Value
flash.initFlash(opts);opts - an object with options for flash messages. If undefined, default settings (see below) will be used.sets up the flash service to be used, no return value

The FlashService has various default settings for messages. Below is the defaultSettings object, that will be angular.extended if you provide an opts object.

defaultSettings = {
        fade: 200, // fade time (ms)
        showFor: 1200 // show message time (ms)
    };

flash

Flash the given message on the screen. Message will appear immediately, stay on screen for settings.showFor time, then fade away for settings.fade time.

Example UsageArgumentsReturn Value
flash.flash(msg);msg - string with the message to flash on screennone

enable

Enable or disable flash messages. Enable will show flash messages, disable will disable flash messages.

Example UsageArgumentsReturn Value
flash.enable(b);

b - truthy or falsy value of whether to enable flash messages

truthy will enable

falsy will disable

flash messages are enabled or disabled

no return value

  • No labels