   handleBlur: (field) ->
     cleanEmail = field.value.replace(/^\s+|\s+$/g, '')
     if @validateEmailFormat(cleanEmail)
-      @submitEmail(cleanEmail)
+      @send(cleanEmail)
 
-  submitEmail: (email) ->
-    endpoint = DEFAULT_NOTIFIER_ENDPOINT
-    data =
-      token: @token
-      url: window.location.origin
-      email: email
+  send: (email) ->
+    if @token
+      endpoint = DEFAULT_NOTIFIER_ENDPOINT
+      data =
+        token: @token
+        url: window.location.origin
+        email: email
 
-    superagent
-      .post(endpoint)
-      .send(data)
+      return superagent
+        .post(endpoint)
+        .send(data)
+    else
+      throw 'Token required to send emails. Do `SignupSumo.setToken(TOKEN)` to set it'
 
   validateEmailFormat: (email) ->
     !!email.match(EMAIL_REGEX)
 
+window.SignupSumo = SignupSumo
+
 loadCompleted = ->
-  new SignupSumo
+  SignupSumo.init()
 
 if document.addEventListener
   document.addEventListener("DOMContentLoaded", loadCompleted, true)


  DEFAULT_EMAIL_INPUT_SELECTOR = 'input[type="email"], input[type="text"]'

  constructor: ->
    @token = document.querySelector('script[data-token]').getAttribute('data-token')
    @debug = document.querySelector('script[data-debug]').getAttribute('data-debug')
    @installListeners()

  forms: ->
    document.forms

#= require superagent

class SignupSumo
  instance = null

  DEFAULT_BASE_ENDPOINT = "http://signupsumo.com/api/v1/"

  DEFAULT_NOTIFIER_ENDPOINT = DEFAULT_BASE_ENDPOINT + "signups"
