Skip to content

Instantly share code, notes, and snippets.

@tomalec
Created March 8, 2017 12:29
Show Gist options
  • Select an option

  • Save tomalec/17ec6dec939720cad3f6d559ce1080d7 to your computer and use it in GitHub Desktop.

Select an option

Save tomalec/17ec6dec939720cad3f6d559ce1080d7 to your computer and use it in GitHub Desktop.
Starcounter App's View example
<!-- dependencies goes here-->
<template>
<!-- All content/functional/meaningful elements goes here -->
<template is="starcounter-composition">
<!-- Shadow DOM layuout goes here -->
</template>
</template>
<!--- VanillaJS example -->
<link rel="import" href="/sys/puppet-redirect/puppet-redirect.html" />
<template>
<button>Click me to redirect</button>
<link is="puppet-redirect" history rel="#" />
<script>
(function(){
let script = document._currentScript || document.currentScript;
let link = script.previousElementSibling;
let button = link.previousElementSibling;
button.addEventListener('click', function(){
link.setAttribute('url', '/go/somewhere');
});
})();
</script>
<template is="starcounter-composition">
<div style="border: 1px solid red;">
<slot name="MyApp/button"></slot>
</div>
</template>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment