Last active
March 26, 2018 04:48
-
-
Save zouhir/21a4bdff21b38ad51925248488682f8d 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
let script = hostElement.querySelector("script"); | |
let scriptType = script.hasAttribute("type") || null; | |
let props = {}; | |
if (scriptType && scriptType === "text/props") { | |
try { | |
props = JSON.parse(script.textContent); // logs { name: "Zouhir"} | |
} catch (e) { | |
throw new Error(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment