Directory

← Back

iron-jsonp-library

Loads jsonp libraries.

Author

Contributors

Rating

Published on NPM Build status Published on webcomponents.org

<iron-jsonp-library>

Loads specified jsonp library.

See: Documentation, Demo.

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>
  <head>
    <script type="module">
      import '@polymer/polymer/lib/elements/dom-bind.js';
      import '@polymer/iron-jsonp-library/iron-jsonp-library.js';
    </script>
  </head>
  <body>
    <dom-bind>
      <template>
        <iron-jsonp-library
            library-url="https://apis.google.com/js/plusone.js?onload=%%callback%%"
            notify-event="api-load"
            library-loaded="{{loaded}}">
        </iron-jsonp-library>
        <span>Library Loaded: [[loaded]]</span>
      </template>
    </dom-bind>
  </body>
</html>

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/iron-jsonp-library/iron-jsonp-library.js';

class SampleElement extends PolymerElement {
  static get template() {
    return html`
      <iron-jsonp-library
            library-url="https://apis.google.com/js/plusone.js?onload=%%callback%%"
            notify-event="api-load"
            library-loaded="{{loaded}}">
        </iron-jsonp-library>
        <span>Library Loaded: [[loaded]]</span>
    `;
  }
}
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

git clone https://github.com/PolymerElements/iron-jsonp-library
cd iron-jsonp-library
npm install
npm install -g polymer-cli

Running the demo locally

polymer serve --npm
open http://127.0.0.1:<port>/demo/

Running the tests

polymer test --npm

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Dependencies

  • @polymer/polymer#^3.0.0
Released
2018-09-14
Maturity
IMPORTED
License
BSD 3-clause "New" or "Revised" License

Compatibility

Framework
Polymer 1.0+
Polymer 3.0+
Polymer 2.0+ in 2.1.0
Browser
Browser Independent

iron-jsonp-library - Vaadin Add-on Directory

Loads jsonp libraries. iron-jsonp-library - Vaadin Add-on Directory
[![Published on NPM](https://img.shields.io/npm/v/@polymer/iron-jsonp-library.svg)](https://www.npmjs.com/package/@polymer/iron-jsonp-library) [![Build status](https://travis-ci.org/PolymerElements/iron-jsonp-library.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-jsonp-library) [![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](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 ``` ### 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 ```
Online