C.2.4. Red Hat Virtualization 사용자 인터페이스 플러그인 부트 스트랩

일반적인 플러그인 부트스트랩 시퀀스는 다음 단계로 구성됩니다.

플러그인 BootstrapECDHE

  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.
api.register({
	    // 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.
api.ready();