Introduction

Welcome to the Medium Framework docs.

The View Object

Below is a view object in it's simplest form:

Utility

_.clone ( a, b, deep, transform, defaults )

Copy an array or object with various options:

DOM Elements

$( selector )

Select matching elements in the DOM:

$.addClass ( ...names )

Add a list of class names to the selected elements:

$.removeClass ( ...names )

Remove a list of class names from the selected elements:

$.toggleClass ( ...names )

Toggle a list of class names from the selected elements:

$.hasClass ( name, all )

Check if a class exists on the selected elements:

$.data ( key, value )

Retrieve or store arbitrary data on the selected elements:

$.attr ( name, value )

Get or set an attribute on the selected elements:

$.removeAttr ( name )

Remove an attribute from the selected elements:

$.eq ( index )

Get the nth element from a list of elements:

$.is ( selector )

Check if any of the selected elements match a selector:

$.clone ( )

Clone the selected elements:

$.before ( html )

Add HTML before an element (to it's parent):

$.after ( html )

Add HTML after an element (to it's parent):

$.prepend ( html )

Add HTML to the start of an element:

$.append ( html )

Add HTML to the end of an element:

$.text ( string )

Get or set the text content of the selected elements:

$.html ( html )

Get or set the html content of the selected elements:

$.val ( value )

Gets or sets the value of an input element:

$.prop ( name, value )

Get or set a property on the selected elements:

DOM Events

$.on ( events, delegate, callback )

Start listening on the selected elements:

$.off ( events, callback )

Stop listening on the selected elements:

$.trigger ( event, data )

Trigger an event on the selected elements:

XHR

xhr.get ( props )

Send a "GET" XMLHttpRequest:

xhr.post ( props )

Send a "POST" XMLHttpRequest:

xhr.request ( props )

Send a customised XMLHttpRequest:

XHR Events [BROKEN]

Manage listeners on any XHR object (in addition to the callbacks on the xhr methods above)

xhr.on ( events, callback )

Start listening on an XMLHttpRequest:

xhr.off ( events, callback )

Stop listening on an XMLHttpRequest: