app/assets/javascripts/luca/core/registry/registry.coffee in luca-0.9.8 vs app/assets/javascripts/luca/core/registry/registry.coffee in luca-0.9.9

- old
+ new

@@ -28,38 +28,36 @@ collection: "collection_view" list: "collection_view" multi: "collection_multi_view" table: "table_view" - # When you use _.def to define a component, you say # which class it extends() from, and with() which enhancements. # We register that component class for you: Luca.registerComponent = (component, prototypeName, componentType="view")-> Luca.trigger "component:registered", component, prototypeName switch componentType when "model" + existing = registry.model_classes[ component ] registry.model_classes[ component ] = prototypeName when "collection" + existing = registry.collection_classes[ component ] registry.collection_classes[ component ] = prototypeName + when "view" + existing = registry.classes[ component ] + registry.classes[ component ] = prototypeName else + existing = registry.classes[ component ] registry.classes[ component ] = prototypeName -Luca.development_mode_register = (component, prototypeName)-> - existing = registry.classes[component] - - if Luca.enableDevelopmentTools is true and existing? - prototypeDefinition = Luca.util.resolve( existing, window) - + if existing? and Luca.config.developmentMode is true liveInstances = Luca.registry.findInstancesByClassName( prototypeName ) + if liveInstances.length > 0 + existingInstance.refreshEventBindings?() for existingInstance in liveInstances - _( liveInstances ).each (instance)-> - instance?.refreshCode?.call(instance, prototypeDefinition) - Luca.registerComponent( component, prototypeName ) - # We create a @ctype alias for this component definition, and register # the class in a registry. # If you use a custom namespace like MyApp.views.ListView, # then we will register MyApp.views as a namespace. You can @@ -120,9 +118,14 @@ className: className ctype: ctype Luca.registry.find = (search)-> Luca.util.resolve(search) || Luca.define.findDefinition(search) + +Luca.remove = Luca.registry.removeInstance = (cacheKey)-> + return unless cacheKey? + _( componentCacheStore.name_index ).delete( cacheKey ) + _( componentCacheStore.cid_index ).delete( cacheKey ) Luca.cache = Luca.registry.cacheInstance = (cacheKey, object)-> return unless cacheKey? return object if object?.doNotCache is true