Sha256: 65b76ef0c8041edcb693d1cc81a9b10bb13fae4f41551ee267cf5c0d052f2d77
Contents?: true
Size: 718 Bytes
Versions: 37
Compression:
Stored size: 718 Bytes
Contents
require 'volt/models/persistors/base' module Persistors class Flash < Base def initialize(model) @model = model end def added(model, index) if Volt.client? # Setup a new timer for clearing the flash. %x{ setTimeout(function() { self.$clear_model(model); }, 5000); } end end def clear_model(model) @model.delete(model) # Clear out the parent collection (usually the main flash) # Makes it so flash.empty? reflects if there is any outstanding # flashes. if @model.size == 0 collection_name = @model.path[-1] @model.parent.delete(collection_name) end end end end
Version data entries
37 entries across 37 versions & 1 rubygems