coffeescripts/shuriken.coffee in shuriken-0.1.0 vs coffeescripts/shuriken.coffee in shuriken-0.1.1
- old
+ new
@@ -3,20 +3,20 @@
(($) ->
stringToDataKey: (key) -> "data-$key".replace /_/g, '-'
$.fn.dataAttr: (key, value) -> @attr stringToDataKey(key), value
$.fn.removeDataAttr: (key) -> @removeAttr stringToDataKey(key)
$.fn.hasDataAttr: (key) -> @is "[${stringToDataKey(key)}]"
- $.getMeta: (key) -> $("meta[name='$key']").attr "content"
+ $.metaAttr: (key) -> $("meta[name='$key']").attr "content"
)(jQuery)
Shuriken: {
Base: {}
Util: {}
jsPathPrefix: "/javascripts/"
jsPathSuffix: ""
- namespaces: {},
+ namespaces: {}
extensions: []
}
Shuriken.Util.underscoreize: (s) ->
s.replace(/\./g, '/').replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2').replace(/([a-z\d])([A-Z])/g, '$1_$2').replace(/-/g, '_').toLowerCase()
@@ -42,11 +42,11 @@
base.getNS: (namespace) ->
parts: key.split "."
currentNS: @
for name in parts
return unless currentNS[name]?
- currentNS = currentNS[name]
+ currentNS: currentNS[name]
currentNS
base.getRootNS: ->
current: @
current: current.parent while current.parent?
@@ -57,11 +57,11 @@
base.withNS: (key, initializer) ->
parts: key.split "."
currentNS: @
for name in parts
- currentNS[name] = makeNS(name, currentNS, @baseNS) if not currentNS[name]?
+ currentNS[name]: makeNS(name, currentNS, @baseNS) if not currentNS[name]?
currentNS: currentNS[name]
hadSetup: $.isFunction currentNS.setup
Shuriken.Util.scopedClosure initializer, currentNS
currentNS.setupVia currentNS.setup if not hadSetup and $.isFunction currentNS.setup
currentNS
@@ -94,11 +94,11 @@
base.autosetup: true
# Used as a part of the prototype chain.
Shuriken.Namespace: ->
-Shuriken.Namespace.prototype = Shuriken.Base;
+Shuriken.Namespace.prototype: Shuriken.Base
makeNS: (name, parent, sharedPrototype) ->
sharedPrototype?= new Shuriken.Namespace()
namespace: ->
@name: name
@@ -122,6 +122,6 @@
Shuriken.root[name]: ns
Shuriken.Util.scopedClosure extension, ns for extension in Shuriken.extensions
ns
Shuriken.root: @
-@['Shuriken'] = Shuriken
+@['Shuriken']: Shuriken