Versions Compared

Key

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

...

Code Block
languagejs
onos.ui.addView('viewId', {
    preloadinit: preloadinit,
    reset: reset,
    load: load,
    unload: unload,
    resize: resize,
    theme: theme
});

...

The second argument to the function is an inline object block with the given keys, whose values are references to view life-cycle callback functions:

preloadinitThis function is called only once, the first time the view is loaded. It is called after the view's <div> has been added to the DOM.
resetThis function is called just before the view is shown. It can be used to clear stale data from the view.
loadThis function is called when the view is loaded.
unloadThis function is called when the view is unloaded. The view may use this to drop references to cached data, or stop background tasks.
resizeThis function is called when the view has been resized.
themeThis function is called when the user has toggled the theme.

...

In the first release, the Topology View is the only view available; it is loaded at GUI startup. The following paragraphs summarize each of the view's callbacks:

...

Init

The preload init callback is used to initialize the view's SVG layer (including pan and zoom controls) and theĀ Force Layout used to visualize the topology.

...