https://github.com/lasalefamine/polymer-lib-loader
Polymer (ES6) external (or internal) library loader component
https://github.com/lasalefamine/polymer-lib-loader
async library loader polymer
Last synced: about 1 year ago
JSON representation
Polymer (ES6) external (or internal) library loader component
- Host: GitHub
- URL: https://github.com/lasalefamine/polymer-lib-loader
- Owner: LasaleFamine
- License: mit
- Created: 2016-09-26T00:02:46.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-09-06T21:50:16.000Z (almost 9 years ago)
- Last Synced: 2024-04-27T05:01:29.802Z (about 2 years ago)
- Topics: async, library, loader, polymer
- Language: JavaScript
- Homepage:
- Size: 130 KB
- Stars: 0
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# `` Polymer (ES6)
[](https://travis-ci.org/LasaleFamine/polymer-lib-loader)
[](https://badge.fury.io/bo/polymer-lib-loader)
[](http://standardjs.com/)
[](https://gemnasium.com/github.com/LasaleFamine/polymer-lib-loader)
> Library loader WebComponent for external (or internal) library. Written in [Polymer 1.0](https://www.polymer-project.org/1.0/) in ES6 syntax.
## Why
A simple component for delegate the task to import an external library.
If you need to wrap a functionality of a library and load it only inside a component.
Example:
``` html
[...]
yourCallbackOnLoad: function () {
console.log('loaded')
yourLib.doingSomenthing('yo')
},
[...]
```
See the [`demo`](https://github.com/LasaleFamine/polymer-lib-loader/blob/master/demo/) folder for more details.
## Install
$ bower install polymer-lib-loader
## Default Properties
``` js
{
/** Instance link **/
lib: {
type: String
},
/** */
libUniqueId: {
type: String
},
/** True when the lib is ready */
libReady: {
type: Boolean,
value: false
}
}
```
## Note on library load
The ability of the component to load the library and not reload it again and again is related to the `libUniqueId`.
The `<script id="yourId" src="yourLibLink">` will be attached as a child of the `body` and **removed when the component is detached** (or when a wrapper of it is detached).
## API
#### .removeLib()
Remove the library from the page
____
### Events
#### on-lib-loaded
When the initialization of the library is complete
## Develop
Clone the repository ***inside a folder*** (ex: `sandbox-polymer-lib-loader/polymer-lib-loader`) and inside the `polymer-lib-loader` folder:
$ npm install && bower install
Developing mode: **watch** on base files and **Babel** that transpiles (http://localhost:8080/polymer-lib-loader/demo)
$ npm start
Build: only the **Babel** action simply run
$ npm run build
## Test
[Standard](https://github.com/feross/standard) for coding style and [WCT](https://github.com/polymer/web-component-tester) for unit test:
$ npm test
## License
[MIT](https://github.com/LasaleFamine/polymer-lib-loader/blob/master/LICENSE.md) © LasaleFamine