Skip to content

Repository files navigation

PolymerVis

PolymerVis is a suite of Polymer elements for visualizations.

Install

bower install PolymerVis/utils-lib --save

Quick start

Import the polymer-vis.html file to use any of the utility functions.

<linkrel="import" href="../bower_components/utils-lib/utils-lib.html">

Alternatively, you can also include it as a script instead.

<scriptsrc="../bower_components/utils-lib/utils-lib.js"></script>

API reference

PolymerVis.loadScript(src, onload, onerror, optAsync) ⇒ HTMLScriptElement

Convenience method for dynamically loading a script.

This method creates a new <script> element with the provided URL and appends it to the document to start loading. In the onload callback, the import property of the link element will contain the imported document contents.

Kind: global method of PolymerVis.loadScript

ParamTypeDescription
srcstringThe url to the script to load.
onloadfunctioncallback when script is loaded.
onerrorfunctioncallback when error loading script.
optAsyncbooleanwhether to execute the script asynchronously.

PolymerVis.loadStylesheet(href, onload, onerror, optAsync) ⇒ HTMLLinkElement

Convenience method for dynamically loading a stylesheet.

This method creates a new <link rel="stylesheet"> element with the provided URL and appends it to the document to start loading. In the onload callback, the import property of the link element will contain the imported document contents.

Kind: global method of PolymerVis.loadStylesheet

ParamTypeDescription
hrefstringThe url to the script to load.
onloadfunctioncallback when script is loaded.
onerrorfunctioncallback when error loading script.
optAsyncbooleanwhether to execute the script asynchronously.

PolymerVis.insertCssIntoShadowRoot(cssSrc, shadowRoot, onload, id) ⏏

Load an external CSS file, and insert a style element into the shadowRoot.

Kind: global method of PolymerVis.insertCssIntoShadowRoot

ParamTypeDescription
cssSrcStringurl to the css file
shadowRootStringNode to insert the style element
onloadfunctioncallback when CSS is inserted
idStringid for style element

Example

PolymerVis.insertCssIntoShadowRoot('https://some.css',ele.shadowRoot,'custom');

PolymerVis.isInShadowRoot(node) ⇒ Node

Check if the node is inside a shadowRoot or not. Return the shadowRoot otherwise return false.

Kind: global method of PolymerVis.isInShadowRoot

ParamTypeDescription
nodeNodethe node to check

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages