import { ILinkInfo } from "../../@types/helper" ; /**
 * Suite Bar Link
 */ export const SuiteBarLink = ( props ) : PromiseLike < HTMLAnchorElement > => { let create = ( ) => { let appendFl = typeof ( props . appendFl ) === "boolean" ? props . appendFl : true ; let link = _elTopLinks . querySelector ( "#" + props . id ) as HTMLAnchorElement ; if ( link == null ) { link = document . createElement ( "a" ) ; link . className = "ms-core-suiteLink-a " + ( props . className || "" ) ; link . href = props . href ? props . href : "javascript:void()" ; link . id = props . id ; link . innerHTML = props . title ; link . onclick = props . onClick as any ; let sbLink = document . createElement ( "li" ) ; sbLink . className = "ms-core-suiteLink" ; sbLink . appendChild ( link ) ; appendFl ? _elTopLinks . appendChild ( sbLink ) : _elTopLinks . insertBefore ( sbLink , _elTopLinks . firstChild ) ; } return link ; } ; let _elTopLinks = null ; let getTopLinks = ( ) => { if ( _elTopLinks == null ) { _elTopLinks = document . querySelector ( "#suiteLinksBox > ul" ) ; } return _elTopLinks ; } ; return new Promise ( ( resolve , reject ) => { if ( getTopLinks ( ) ) { let el = create ( ) ; if ( el ) { resolve ( el ) ; } } else if ( window ) { window . addEventListener ( "load" , ( ) => { if ( getTopLinks ( ) ) { let el = create ( ) ; if ( el ) { resolve ( el ) ; } } } ) ; } } ) ; } ;