import { ILinkInfo } from "../../@types/helper" ; /**
 * Ribbon Link
 */ export const RibbonLink = ( props ) : PromiseLike < HTMLAnchorElement > => { let create = ( ) => { let link = null ; let appendFl = typeof ( props . appendFl ) === "boolean" ? props . appendFl : false ; link = _elTopBar . querySelector ( "#" + props . id ) as HTMLAnchorElement ; if ( link == null ) { link = document . createElement ( "a" ) ; link . className = "ms-promotedActionButton " + ( props . className || "" ) ; link . href = props . href ? props . href : "javascript:void()" ; link . innerHTML = "<span class='ms-promotedActionButton-text'>" + props . title + "</span>" ; link . id = props . id ; link . onclick = props . onClick as any ; appendFl ? _elTopBar . appendChild ( link ) : _elTopBar . insertBefore ( link , _elTopBar . firstChild ) ; } return link ; } ; let _elTopBar = null ; let getTopBar = ( ) => { if ( _elTopBar == null ) { _elTopBar = document . querySelector ( "#RibbonContainer-TabRowRight" ) ; } return _elTopBar ; } ; return new Promise ( ( resolve , reject ) => { if ( getTopBar ( ) ) { let el = create ( ) ; if ( el ) { resolve ( el ) ; } } else if ( window ) { window . addEventListener ( "load" , ( ) => { if ( getTopBar ( ) ) { let el = create ( ) ; if ( el ) { resolve ( el ) ; } } } ) ; } } ) ; } ;