2.1.1 • Published 8 years ago

async-components v2.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

async-components

Async components allows splitting the web into independent components and easily integrate them, asynchronously.

Demo

http://msn0.github.io/async-components

Installation

npm i async-components
# or
bower i async-components

Usage

Include async-components straight after the <body> tag:

<script src="async-components.es5.min.js"></script>

Define components:

<body>
  <div data-component="/header.html" data-event="header-loaded"></div>
  <div data-component="/listing.html" data-event="listing-loaded"></div>
  <div data-component="/footer.html" data-event="footer-loaded"></div>
</body>

Once component is loaded, the corresponding event is emmited. Let's say listing depends on header. Then listing should listen for header-loaded event, e.g.

document.addEventListener('header-loaded', (data) => {
  console.log(data);
});

License

MIT

2.1.1

8 years ago

2.1.0

8 years ago

2.0.1

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago