Core

  1. Sammy

  2. Sammy.Application

    1. $element
    2. after
    3. any
    4. around
    5. before
    6. bind
    7. bindToAllEvents
    8. clearTemplateCache
    9. contextMatchesOptions
    10. del
    11. error
    12. eventNamespace
    13. get
    14. getLocation
    15. helper
    16. helpers
    17. isRunning
    18. lookupRoute
    19. mapRoutes
    20. notFound
    21. post
    22. put
    23. refresh
    24. routablePath
    25. route
    26. run
    27. runRoute
    28. setLocation
    29. setLocationProxy
    30. swap
    31. templateCache
    32. toString
    33. trigger
    34. unload
    35. use
  3. Sammy.EventContext

    1. $element
    2. engineFor
    3. eventNamespace
    4. interpolate
    5. json
    6. load
    7. notFound
    8. partial
    9. redirect
    10. render
    11. renderEach
    12. send
    13. swap
    14. toString
    15. trigger
  4. Sammy.HashLocationProxy

    1. bind
    2. getLocation
    3. setLocation
    4. unbind
  5. Sammy.Object

    1. escapeHTML
    2. has
    3. join
    4. keys
    5. log
    6. toHTML
    7. toHash
    8. toString
  6. Sammy.RenderContext

    1. appendTo
    2. collect
    3. interpolate
    4. load
    5. next
    6. partial
    7. prependTo
    8. render
    9. renderEach
    10. replace
    11. send
    12. swap
    13. then
    14. trigger
    15. wait
  7. Sammy.addLogger

  8. Sammy.log

Plugins

  1. Sammy.Cache

  2. Sammy.DataCacheProxy

  3. Sammy.DataLocationProxy

  4. Sammy.Form

  5. Sammy.FormBuilder

  6. Sammy.GoogleAnalytics

  7. Sammy.Haml

  8. Sammy.Handlebars

  9. Sammy.JSON

  10. Sammy.Meld

  11. Sammy.MemoryCacheProxy

  12. Sammy.Mustache

  13. Sammy.NestedParams

  14. Sammy.OAuth2

  15. Sammy.PathLocationProxy

  16. Sammy.Pure

  17. Sammy.Session

  18. Sammy.Storage

  19. Sammy.Store

  20. Sammy.Store.Cookie

  21. Sammy.Store.Data

  22. Sammy.Store.LocalStorage

  23. Sammy.Store.Memory

  24. Sammy.Store.SessionStorage

  25. Sammy.Store.isAvailable

  26. Sammy.Template

  27. Sammy.Title

« Back

Sammy.Application use ( )

use() is the entry point for including Sammy plugins. The first argument to use should be a function() that is evaluated in the context of the current application, just like the app_function argument to the Sammy.Application constructor.

Any additional arguments are passed to the app function sequentially.

For much more detail about plugins, check out: http://sammyjs.org/docs/plugins

Example

 var MyPlugin = function(app, prepend) {

   this.helpers({
     myhelper: function(text) {
       alert(prepend + " " + text);
     }
   });

 };

 var app = $.sammy(function() {

   this.use(MyPlugin, 'This is my plugin');

   this.get('#/', function() {
     this.myhelper('and dont you forget it!');
     //=> Alerts: This is my plugin and dont you forget it!
   });

 });

If plugin is passed as a string it assumes your are trying to load Sammy."Plugin". This is the prefered way of loading core Sammy plugins as it allows for better error-messaging.

Example

 $.sammy(function() {
   this.use('Mustache'); //=> Sammy.Mustache
   this.use('Storage'); //=> Sammy.Storage
 });
comments powered by Disqus