From cdf451e2b5574d728aa15def94d37c190cc245c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Moreira?= Date: Wed, 11 May 2016 21:28:39 +0100 Subject: [PATCH] Add UMD support and export WOW class as default --- src/wow.coffee | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/wow.coffee b/src/wow.coffee index 7acea88..5a2731d 100644 --- a/src/wow.coffee +++ b/src/wow.coffee @@ -6,7 +6,6 @@ # Website : http://mynameismatthieu.com/wow # - class Util extend: (custom, defaults) -> custom[key] ?= value for key, value of defaults @@ -99,7 +98,7 @@ getComputedStyle = @getComputedStyle or \ @ getComputedStyleRX = /(\-([a-z]){1})/g -class @WOW +class WOW defaults: boxClass: 'wow' animateClass: 'animated' @@ -288,3 +287,13 @@ class @WOW disabled: -> not @config.mobile and @util().isMobile(navigator.userAgent) + +umd = (factory) -> + if typeof exports is 'object' + module.exports = factory() + else if typeof define is 'function' and define.amd + define([], factory) + else + @WOW = factory() + +umd -> WOW