The Shoes Manual

Manipulation Blocks

The manipulation methods below make quick work of shifting around slots and inserting new elements.

Adds elements to the end of a slot.

 Shoes.app do
   @slot = stack { para 'Good Morning' }
   timer 3 do
     @slot.append do
       title "Breaking News"
       tagline "Astronauts arrested for space shuttle DUI."
     end
   end
 end

The title and tagline elements will be added to the end of the @slot.

Adds elements to a specific place in a slot, just after the element which is a child of the slot.

Adds elements to a specific place in a slot, just before the element which is a child of the slot.

clear() » self

Empties the slot of any elements, timers and nested slots. This is effectively identical to looping through the contents of the slot and calling each element's remove method.

The clear method also takes an optional block. The block will be used to replace the contents of the slot.

 Shoes.app do
   @slot = stack { para "Old text" }
   timer 3 do
     @slot.clear { para "Brand new text" }
   end
 end

In this example, the "Old text" paragraph will be cleared out, replaced by the "Brand new text" paragraph.

Adds elements to the beginning of a slot.

 Shoes.app do
   @slot = stack { para 'Good Morning' }
   timer 3 do
     @slot.prepend { para "Your car is ready." }
   end
 end

The para element is added to the beginning of the @slot.

Next: Position of a Slot