Created
July 28, 2016 16:39
-
-
Save colelawrence/6bf36ad9c2b22f46835da887b20a1f54 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Helper function gets element of type T from parent dom element | |
| function getElement<T>(parent: HTMLElement, selector: string): Promise<T> { | |
| return new Promise<T>((resolve, reject) => { | |
| setTimeout( | |
| () => { | |
| try { | |
| resolve(<T><any> parent.querySelector(selector)); | |
| } catch (error) { | |
| reject(error); | |
| } | |
| }, | |
| 0 | |
| ); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment