fruitmachine-media ![Build Status](https://travis-ci.org/ftlabs/fruitmachine-media.svg?branch=master)
FruitMachine helper that allows different setup and teardown callbacks to be called based on media queries. If asychronous logic is needed to be run within a teardown
or setup
callback, return a promise.
Example usage
var fm = require('fruitmachine');
fm.define({
name: 'passionfruit',
template: function() {
},
helpers: [
require('fruitmachine-media')
],
media: {
'(max-width: 699px), (max-height: 699px)': 'small',
'(min-width: 700px) and (min-height: 700px)': 'large'
},
states: {
small: {
setup: function(options) {
},
teardown: function(options) {
}
},
large: {
setup: function(options) {
},
teardown: function(options) {
}
}
}
});
License
Copyright (c) 2014 The Financial Times Limited
Licensed under the MIT license.
Credits and collaboration
All open source code released by FT Labs is licenced under the MIT licence. We welcome comments, feedback and suggestions. Please feel free to raise an issue or pull request.