Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UMD support and export WOW class as default #249

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add UMD support and export WOW class as default
  • Loading branch information
José Moreira committed May 11, 2016
commit cdf451e2b5574d728aa15def94d37c190cc245c1
13 changes: 11 additions & 2 deletions src/wow.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Website : http://mynameismatthieu.com/wow
#


class Util
extend: (custom, defaults) ->
custom[key] ?= value for key, value of defaults
Expand Down Expand Up @@ -99,7 +98,7 @@ getComputedStyle = @getComputedStyle or \
@
getComputedStyleRX = /(\-([a-z]){1})/g

class @WOW
class WOW
defaults:
boxClass: 'wow'
animateClass: 'animated'
Expand Down Expand Up @@ -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