https://github.com/polymerelements/iron-jsonp-library
Loads jsonp libraries.
https://github.com/polymerelements/iron-jsonp-library
Last synced: 11 months ago
JSON representation
Loads jsonp libraries.
- Host: GitHub
- URL: https://github.com/polymerelements/iron-jsonp-library
- Owner: PolymerElements
- Created: 2015-04-28T22:16:19.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-10-16T14:04:36.000Z (over 2 years ago)
- Last Synced: 2024-11-20T15:52:09.276Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 228 KB
- Stars: 14
- Watchers: 15
- Forks: 14
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/@polymer/iron-jsonp-library)
[](https://travis-ci.org/PolymerElements/iron-jsonp-library)
[](https://webcomponents.org/element/@polymer/iron-jsonp-library)
## <iron-jsonp-library>
Loads specified jsonp library.
See: [Documentation](https://www.webcomponents.org/element/@polymer/iron-jsonp-library),
[Demo](https://www.webcomponents.org/element/@polymer/iron-jsonp-library/demo/demo/index.html).
## Polymer.IronJsonpLibraryBehavior
`Polymer.IronJsonpLibraryBehavior` loads a jsonp library.
Multiple components can request same library, only one copy will load.
Some libraries require a specific global function be defined.
If this is the case, specify the `callbackName` property.
You should use an HTML Import to load library dependencies
when possible instead of using this element.
## Usage
### Installation
```
npm install --save @polymer/iron-jsonp-library
```
### In an html file
```html
import '@polymer/polymer/lib/elements/dom-bind.js';
import '@polymer/iron-jsonp-library/iron-jsonp-library.js';
Library Loaded: [[loaded]]
```
### In a Polymer 3 element
```js
import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/iron-jsonp-library/iron-jsonp-library.js';
class SampleElement extends PolymerElement {
static get template() {
return html`
Library Loaded: [[loaded]]
`;
}
}
customElements.define('sample-element', SampleElement);
```
## Contributing
If you want to send a PR to this element, here are
the instructions for running the tests and demo locally:
### Installation
```sh
git clone https://github.com/PolymerElements/iron-jsonp-library
cd iron-jsonp-library
npm install
npm install -g polymer-cli
```
### Running the demo locally
```sh
polymer serve --npm
open http://127.0.0.1:/demo/
```
### Running the tests
```sh
polymer test --npm
```