Skip to content

Commit

Permalink
Merge branch 'release/4.1.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirk Lüth authored and Dirk Lüth committed Feb 1, 2017
2 parents 017d2c0 + 000bfca commit f2104aa
Show file tree
Hide file tree
Showing 25 changed files with 202 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ In some cases you might want to load (e.g.) a CSS resource via ```demand``` (dir


## More about handlers
```demand``` comes with handlers for ```modules```, ```legacy```scripts, ```bundles```, ```text```, ```css``` and ```json```. Handlers have four objectives:
```demand``` comes with handlers for ```modules```, ```components```, ```legacy```scripts, ```bundles```, ```text```, ```html```, ```css``` and ```json```. Handlers have four objectives:

- provide an optional function named ```onPreRequest``` that modifies the final URL (e.g. add a file extension like ```.js```) before requesting it via XHR/XDR
- provide an optional function named ```onPostRequest``` that, if present, handles necessary conversion of the loaded source (e.g. CSS paths that are normally relative to the CSS-file path)
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qoopido.demand",
"version": "4.1.5",
"version": "4.1.6",
"homepage": "https://github.com/dlueth/qoopido.demand",
"authors": [
"Dirk Lueth <[email protected]>"
Expand Down
31 changes: 31 additions & 0 deletions demo/app/component/example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script type="module">
(function() {
function definition() {
return function() {
console.log('main');
}
}

provide(definition);
}());
</script>

<script type="module" path="secondary">
(function() {
function definition() {
return function() {
console.log('secondary');
}
}

provide(definition);
}());
</script>

<script type="css">
#blubb { color: #f00; }
</script>

<script type="html">
<h1>Headline</h1>
</script>
18 changes: 14 additions & 4 deletions demo/app/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
pattern: {
'/nucleus': '//cdn.jsdelivr.net/qoopido.nucleus/2.0.1/',
'/jquery': '//cdn.jsdelivr.net/jquery/1.11.3/jquery.min',
'/jquery/ui': '//cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min',
'/jquery/ui': '//cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min',
'/velocity': '//cdn.jsdelivr.net/velocity/1.2.3/velocity.min.js',
'/leaflet': '//cdn.jsdelivr.net/leaflet/0.7.3/leaflet.js',
'/velocity+leaflet': '//cdn.jsdelivr.net/g/[email protected],[email protected]'
Expand Down Expand Up @@ -180,11 +180,11 @@
log('demand', '/app/js/simple', 'rejected');
}
),
// load text (HTML in this case)
demand('text!../html/dummy.html')
// load html
demand('html!../html/dummy')
.then(
function(appHtmlDummy) {
log('demand', '/app/html/dummy', 'resolved', 'text, cookie, compress, sri');
log('demand', '/app/html/dummy', 'resolved', 'html, cookie, compress, sri');
},
function() {
log('demand', '/app/html/dummy', 'rejected');
Expand Down Expand Up @@ -243,6 +243,16 @@
log('demand', '/nucleus/dom/element', 'rejected');
log('demand', '/nucleus/dom/collection', 'rejected');
}
),
// load components
demand('component!/app/component/example')
.then(
function(primaryModule, secondaryModule, primaryCss, primaryHtml) {
log('demand', '/app/component/example', 'resolved', 'component, 2 modules, CSS & HTML');
},
function() {
log('demand', '/app/component/example', 'rejected');
}
)
])
})
Expand Down
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

target.parentNode.insertBefore(script, target);
}(window, document, 'script'))
}('../dist/demand.js', 'app/js/main', { base: './', version: '4.1.5', cache: false }));
}('../dist/demand.js', 'app/js/main', { base: './', version: '4.1.6', cache: false }));
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion dist/cache/dispose.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/demand.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/demand.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/handler/css.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/handler/html.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/handler/html.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/handler/json.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/handler/legacy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/handler/text.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/plugin/cookie.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/plugin/lzstring.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f2104aa

Please sign in to comment.