C.2.4. Red Hat Virtualization 用户界面插件

典型的插件 bootstrap 序列由以下步骤组成:

插件 Bootstrap 序列

  1. 获取给定插件的 pluginApi 实例
  2. 获取运行时插件配置对象(可选)
  3. 注册相关事件处理程序功能
  4. 通知 UI 插件基础架构以继续插件初始化


// Access plug-in API using 'parent' due to this code being evaluated within the context of an iframe element.
// As 'parent.pluginApi' is subject to Same-Origin Policy, this will only work when WebAdmin HTML page and plug-in
// host page are served from same origin. WebAdmin HTML page and plug-in host page will always be on same origin
// when using UI plug-in infrastructure support to serve plug-in resource files.
var api = parent.pluginApi('MyPlugin');

// Runtime configuration object associated with the plug-in (or an empty object).
var config = api.configObject();

// Register event handler function(s) for later invocation by UI plug-in infrastructure.
	    // UiInit event handler function.
		UiInit: function() {
				// Handle UiInit event.
					window.alert('Favorite music band is ' + config.band);

// Notify UI plug-in infrastructure to proceed with plug-in initialization.