New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fruitmachine-media

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fruitmachine-media

FruitMachine helper that allows different setup and teardown callbacks to be called based on media queries

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
439
decreased by-36.38%
Maintainers
4
Weekly downloads
 
Created
Source

fruitmachine-media Build Status

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() {
    // Normal fruitmachine template method
  },

  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) {
        // Run small setup logic
      },
      teardown: function(options) {
        // Run small teardown logic
      }
    },
    large: {
      setup: function(options) {
        // Run large setup logic

        // If asychronous logic needs to be run:-
        //
        // var promise = new Promise();
        // doAsyncStuff(function() {
        //   promise.resolve();
        // });
        // return promise;
      },
      teardown: function(options) {
        // Run large teardown logic
      }
    }
  }
});

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.

FAQs

Package last updated on 14 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc