Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apendua/meteor-layers
A package for atmosphere layers management
https://github.com/apendua/meteor-layers
Last synced: 9 days ago
JSON representation
A package for atmosphere layers management
- Host: GitHub
- URL: https://github.com/apendua/meteor-layers
- Owner: apendua
- Created: 2014-07-30T09:35:40.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-29T00:02:27.000Z (about 10 years ago)
- Last Synced: 2024-10-19T16:47:57.443Z (20 days ago)
- Language: JavaScript
- Size: 160 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Unfortunatelly the PR this package depended on was rejected, but all described features are implemented in another package called [anti:modules](https://github.com/anticoders/meteor-modules).
meteor-layers
=============~~This is a proof-of-concept package designed to work with experimental meteor lazy loading feature.~~
The basic idea is that everything you define under `/client/layers/` gets squashed into independent layers, which you can download on demand. For example, if your project structure looks lie:
```
client
layers
dashboard
admin.html
admin.js
someModule
file1.js
file2.js
...
```
you will get two layers called `dashboard` and `someModule`. They will be served on `/client/layers/dashboard.js` and `/client/layers/module.js` respectively, but they won't be included as `` tags in the initial page.Also packages can define their own layers by specyfying it in `fileOptions` object on call to `add_files`, e.g.
```javascript
api.add_files([ /* ... */ ], 'client', { layer: 'someOptionalFeature' });
```
On the client, there is a global array called `layers` containing a list of all layers defined for the app. Eg.
```javascript
__atmosphere_layers__ = [
{ name: 'dashboard' , path: '/client/layers/dashboard?[hash]' },
{ name: 'someModule' , path: '/client/layers/someModule?[hash]' },
/* ... */
];
```
This object is used by the `layers` package that provides a convenient amd-style API for loading individual layers.
So for example if you need the `dashboard` layer, you only need to do something like this:
```javascript
Layers.require('dashboard', function () {
console.log('ready! dashboard is loaded');
});
```