javascript - Calling shared services or libraries from a Polymer 1.0 custom element -


with angularjs it's possible share functionality between directives e.g. injecting common service each directive wishes consume it.

i'm learning polymer 1.0 custom elements , wondering how shared javascript service/library consumed custom element? service/library isn't 3rd-party can modify please, should possible invoke legacy/non-polymer code.

examples of shared services dialog service, or service responsible formatting date/time etc. offer arbitrary behaviour may involve remote call to, say, web service.

what best practices in regard? implement behaviour described in following link?

https://www.polymer-project.org/1.0/docs/devguide/behaviors.html

the javascript functions in polymer element can consume library available them. libraries expose global variables through can consumed, e.g. jquery's $ , lodash's _ can used globally. similarly, library can expose global variable, e.g. mylib through can consume api, e.g. mylib.formattime, mylib.dialogservice.

polymer behaviors typically used sharing common functions between polymer elements.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -