Class Index | File Index

Classes


Namespace fabric.util


Defined in: util.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
<static>  
fabric.util.addClass(element, className)
Adds class to an element
<static>  
fabric.util.addListener(element, eventName, handler)
Adds an event listener to an element
<static>  
fabric.util.animate(options)
Changes value from one to another within certain period of time, invoking callbacks as value is being changed.
<static>  
fabric.util.createClass()
Helper for creation of "classes"
<static>  
fabric.util.degreesToRadians(degrees)
Transforms degrees to radians.
<static>  
fabric.util.fabric.Observable.fire(eventName, memo)
Fires event with an optional memo object
<static>  
fabric.util.fabric.Observable.stopObserving(eventName, handler)
<static>  
fabric.util.falseFunction()
Function which always returns `false`.
<static>  
fabric.util.getById(id)
Takes id and returns an element with that id (if one exists in a document)
<static>  
fabric.util.getElementOffset(element)
Returns offset for a given element
<static>  
fabric.util.getPointer(event)
Cross-browser wrapper for getting event's coordinates
<static>  
fabric.util.getRandomInt(min, max)
Returns random number between 2 specified ones.
<static>  
fabric.util.getScript(url, callback)
Inserts a script element with a given url into a document; invokes callback, when that script is finished loading
<static>  
fabric.util.makeElement(tagName, attributes)
Creates specified element with specified attributes
<static>  
fabric.util.makeElementUnselectable(element)
Makes element unselectable
<static>  
fabric.util.removeFromArray(array, value)
Removes value from an array.
<static>  
fabric.util.removeListener(element, eventName, handler)
Removes an event listener from an element
<static>  
fabric.util.request(url, options)
Cross-browser abstraction for sending XMLHttpRequest
<static>  
fabric.util.setStyle(element, styles)
Cross-browser wrapper for setting element's style
<static>  
fabric.util.toArray(arrayLike)
Converts an array-like object (e.g.
<static>  
fabric.util.toFixed(number, fractionDigits)
A wrapper around Number#toFixed, which contrary to native method returns number, not string.
<static>  
fabric.util.wrapElement(element, wrapper, attributes)
Wraps element with another element
Namespace Detail
fabric.util
Method Detail
<static> fabric.util.addClass(element, className)
Adds class to an element
Defined in: dom_misc.js.
Parameters:
{HTMLElement} element
Element to add class to
{String} className
Class to add to an element

<static> fabric.util.addListener(element, eventName, handler)
Adds an event listener to an element
Defined in: dom_event.js.
Parameters:
{HTMLElement} element
{String} eventName
{Function} handler

<static> fabric.util.animate(options)
Changes value from one to another within certain period of time, invoking callbacks as value is being changed.
Defined in: dom_misc.js.
Parameters:
{Object} options Optional
Animation options
{Function} options.onChange Optional
Callback; invoked on every value change
{Function} options.onComplete Optional
Callback; invoked when value change is completed
{Number} options.startValue Optional, Default: 0
Starting value
{Number} options.endValue Optional, Default: 100
Ending value
{Function} options.easing Optional
Easing function
{Number} options.duration Optional, Default: 500
Duration of change

<static> fabric.util.createClass()
Helper for creation of "classes"
Defined in: lang_class.js.

<static> {Number} fabric.util.degreesToRadians(degrees)
Transforms degrees to radians.
Defined in: misc.js.
Parameters:
{Number} degrees
value in degrees
Returns:
{Number} value in radians

<static> fabric.util.fabric.Observable.fire(eventName, memo)
Fires event with an optional memo object
Defined in: observable.js.
Parameters:
{String} eventName
{Object} memo Optional

<static> fabric.util.fabric.Observable.stopObserving(eventName, handler)

Defined in: observable.js.
Parameters:
{String} eventName
{Function} handler

<static> {Boolean} fabric.util.falseFunction()
Function which always returns `false`.
Defined in: misc.js.
Returns:
{Boolean}

<static> {HTMLElement|null} fabric.util.getById(id)
Takes id and returns an element with that id (if one exists in a document)
Defined in: dom_misc.js.
Parameters:
{String|HTMLElement} id
Returns:
{HTMLElement|null}

<static> {Object} fabric.util.getElementOffset(element)
Returns offset for a given element
Defined in: dom_misc.js.
Parameters:
{HTMLElement} element
Element to get offset for
Returns:
{Object} Object with "left" and "top" properties

<static> fabric.util.getPointer(event)
Cross-browser wrapper for getting event's coordinates
Defined in: dom_event.js.
Parameters:
{Event} event

<static> {Number} fabric.util.getRandomInt(min, max)
Returns random number between 2 specified ones.
Defined in: misc.js.
Parameters:
{Number} min
lower limit
{Number} max
upper limit
Returns:
{Number} random value (between min and max)

<static> fabric.util.getScript(url, callback)
Inserts a script element with a given url into a document; invokes callback, when that script is finished loading
Defined in: dom_misc.js.
Parameters:
{String} url
URL of a script to load
{Function} callback
Callback to execute when script is finished loading

<static> {HTMLElement} fabric.util.makeElement(tagName, attributes)
Creates specified element with specified attributes
Defined in: dom_misc.js.
Parameters:
{String} tagName
Type of an element to create
{Object} attributes Optional
Attributes to set on an element
Returns:
{HTMLElement} Newly created element

<static> {HTMLElement} fabric.util.makeElementUnselectable(element)
Makes element unselectable
Defined in: dom_misc.js.
Parameters:
{HTMLElement} element
Element to make unselectable
Returns:
{HTMLElement} Element that was passed in

<static> {Array} fabric.util.removeFromArray(array, value)
Removes value from an array. Presence of value (and its position in an array) is determined via `Array.prototype.indexOf`
Defined in: misc.js.
Parameters:
{Array} array
{Any} value
Returns:
{Array} original array

<static> fabric.util.removeListener(element, eventName, handler)
Removes an event listener from an element
Defined in: dom_event.js.
Parameters:
{HTMLElement} element
{String} eventName
{Function} handler

<static> {XMLHttpRequest} fabric.util.request(url, options)
Cross-browser abstraction for sending XMLHttpRequest
Defined in: dom_request.js.
Parameters:
{String} url
URL to send XMLHttpRequest to
{Object} options Optional
Options object
{String} options.method Optional, Default: "GET"
{Function} options.onComplete
Callback to invoke when request is completed
Returns:
{XMLHttpRequest} request

<static> {HTMLElement} fabric.util.setStyle(element, styles)
Cross-browser wrapper for setting element's style
Defined in: dom_style.js.
Parameters:
{HTMLElement} element
{Object} styles
Returns:
{HTMLElement} Element that was passed as a first argument

<static> {Array} fabric.util.toArray(arrayLike)
Converts an array-like object (e.g. arguments or NodeList) to an array
Defined in: dom_misc.js.
Parameters:
{Object} arrayLike
Returns:
{Array}

<static> {Number} fabric.util.toFixed(number, fractionDigits)
A wrapper around Number#toFixed, which contrary to native method returns number, not string.
Defined in: misc.js.
Parameters:
{Number | String} number
number to operate on
{Number} fractionDigits
number of fraction digits to "leave"
Returns:
{Number}

<static> {HTMLElement} fabric.util.wrapElement(element, wrapper, attributes)
Wraps element with another element
Defined in: dom_misc.js.
Parameters:
{HTMLElement} element
Element to wrap
{HTMLElement|String} wrapper
Element to wrap with
{Object} attributes Optional
Attributes to set on a wrapper
Returns:
{HTMLElement} wrapper

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jun 28 2011 18:47:44 GMT-0400 (EDT)