φ Famo.us University Famo.us/Angular Docs Help Blog Download
  • core
  • Context
  • ElementAllocator
  • ElementOutput
  • Engine
  • Entity
  • EventEmitter
  • EventHandler
  • Group
  • Modifier
  • OptionsManager
  • RenderNode
  • Scene
  • SpecParser
  • Transform
  • View
  • ViewSequence
  • events
  • EventArbiter
  • EventFilter
  • EventMapper
  • inputs
  • Accumulator
  • GenericSync
  • MouseSync
  • PinchSync
  • RotateSync
  • ScaleSync
  • ScrollSync
  • TouchSync
  • TouchTracker
  • TwoFingerSync
  • math
  • Matrix
  • Quaternion
  • Random
  • Utilities
  • Vector
  • modifiers
  • Draggable
  • Fader
  • ModifierChain
  • StateModifier
  • physics
  • PhysicsEngine
  • physics/bodies
  • Body
  • Circle
  • Particle
  • Rectangle
  • physics/constraints
  • Surface
  • Collision
  • Constraint
  • Curve
  • Distance
  • Snap
  • Wall
  • Walls
  • physics/forces
  • Drag
  • Force
  • Repulsion
  • RotationalDrag
  • RotationalSpring
  • Spring
  • VectorField
  • physics/integrators
  • SymplecticEuler
  • surfaces
  • CanvasSurface
  • ContainerSurface
  • ImageSurface
  • InputSurface
  • TextareaSurface
  • VideoSurface
  • transitions
  • CachedMap
  • Easing
  • MultipleTransition
  • SnapTransition
  • SpringTransition
  • Transitionable
  • TransitionableTransform
  • TweenTransition
  • WallTransition
  • utilities
  • KeyCodes
  • Timer
  • Utility
  • views
  • ContextualView
  • Deck
  • DrawerLayout
  • EdgeSwapper
  • FlexibleLayout
  • Flipper
  • GridLayout
  • HeaderFooterLayout
  • Lightbox
  • RenderController
  • ScrollContainer
  • Scroller
  • Scrollview
  • SequentialLayout
  • widgets
  • NavigationBar
  • TabBar

Engine

The singleton object initiated upon process startup which manages all active Context instances, runs the render dispatch loop, and acts as a listener and dispatcher for events. All methods are therefore static. On static initialization, window.requestAnimationFrame is called with the event loop function. Note: Any window in which Engine runs will prevent default scrolling behavior on the 'touchmove' event.

Overview

Methods
pipe
unpipe
on
emit
removeListener
getFPS
setFPSCap
getOptions
setOptions
createContext
registerContext
getContexts
deregisterContext
nextTick
defer
Methods

step()PrivateStatic

Inside requestAnimationFrame loop, step() is called, which: calculates current FPS (throttling loop if it is over limit set in setFPSCap), emits dataless 'prerender' event on start of loop, calls in order any one-shot functions registered by nextTick on last loop, calls Context.update on all Context objects registered, and emits dataless 'postrender' event on end of loop.

initialize()PrivateStatic

Initialize famous for app mode

pipe(target)

Add event handler object to set of downstream handlers.

Parameters
target
EventHandler
event handler target object
Returns
EventHandler
passed event handler

unpipe(target)

Remove handler object from set of downstream handlers. Undoes work of "pipe".

Parameters
target
EventHandler
target handler object
Returns
EventHandler
provided target

on(type, handler)Static

Bind a callback function to an event type handled by this object.

Parameters
type
String
event type key (for example, 'click')
handler
Function(string, Object)
callback
Returns
EventHandler
this

emit(type, event)

Trigger an event, sending to all downstream handlers listening for provided 'type' key.

Parameters
type
String
event type key (for example, 'click')
event
Object
event data
Returns
EventHandler
this

removeListener(type, handler)Static

Unbind an event by type and handler. This undoes the work of "on".

Parameters
type
String
event type key (for example, 'click')
handler
Function
function object to remove
Returns
EventHandler
internal event handler object (for chaining)

getFPS()Static

Return the current calculated frames per second of the Engine.

Returns
Number
calculated fps

setFPSCap(fps)Static

Set the maximum fps at which the system should run. If internal render loop is called at a greater frequency than this FPSCap, Engine will throttle render and update until this rate is achieved.

Parameters
fps
Number
maximum frames per second

getOptions(key)Static

Return engine options.

Parameters
key
String
Returns
Object
engine options

setOptions(options)Static

Set engine options

Parameters
options
Object
overrides of default options

createContext(el)Static

Creates a new Context for rendering and event handling with provided document element as top of each tree. This will be tracked by the process-wide Engine.

Parameters
el
Node
will be top of Famo.us document element tree
Returns
Context
new Context within el

registerContext(context)Static

Registers an existing context to be updated within the run loop.

Parameters
context
Context
Context to register
Returns
FamousContext
provided context

getContexts()Static

Returns a list of all contexts.

Returns
Array
contexts that are updated on each tick

deregisterContext(context)Static

Removes a context from the run loop. Note: this does not do any cleanup.

Parameters
context
Context
Context to deregister

nextTick(fn)Static

Queue a function to be executed on the next tick of the Engine.

Parameters
fn
Function(Object)
function accepting window object

defer(fn)Static

Queue a function to be executed sometime soon, at a time that is unlikely to affect frame rate.

Parameters
fn
Function
Branding Terms Privacy Jobs © Famous Industries, Inc. 2015