can.util

  • page
can.util  

can.util adds the following utility functions to CanJS:

  • $ - make a dependency library's NodeList
  • Deferred - create a new Deferred object
  • Object.same - checks if two Objects are the same
  • Object.subset - determines if an Object is a subset of another Object
  • Object.subsets - returns the Object that contain the subset
  • addClass - add a class to Elements in a NodeList
  • ajax - make an AJAX request
  • append - append content to the Elements of a NodeList
  • batch - specify atomic operations by preventing/allowing change events
  • bind - listen for events from an object
  • buildFragment - make a document fragment
  • camelize - capitalize the first letter after each hyphen in a string
  • capitalize - capitalize the first letter of a string
  • data - associate data with or retrieve data from DOM nodes
  • delegate - listen for events from the children of an Element
  • deparam - convert a query String to an Object literal
  • each - iterate through an Array or Object
  • esc - escapes a String for insertion into HTML
  • events - adds the attributes, inserted, and removed DOM events to the base library
  • extend - merge a number of Objects together
  • frag - convert various objects into a DocumentFragment
  • getObject - retrieve an object from a String path
  • hyphenate - adds a hyphen before each uppercase letter and converts the entire string to lower case
  • isArray - check if an object is an array
  • isDeferred - check if an object is a Deferred
  • isEmptyObject - check if an object has no properties
  • isFunction - check if an object is a function
  • makeArray - convert an array-like object to an Array
  • off - stop listening for events on an object
  • on - listen for events on an object
  • param - serialize an object into a query String
  • proxy - bind a function to a context
  • remove - remove Elements from the DOM
  • sub - returns a string with {param} replaced by property values
  • trigger - trigger an event on an Object
  • trim - trim whitespace from a String
  • unbind - stop listening for events on an Object
  • undelegate - stop listening for events from the children of an Element
  • underscore - convert a CamelCase or mixedCase string and underscores the String on the capital letter
  • viewModel - read and write a component element's viewModel
  • when - call a callback Function when a Deferred resolves