Namespace sc.helpers

Defined in: spazcore.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 

Method Summary
Method Attributes Method Name and Description
<static>  
sc.helpers.activateWindow(opts)

<static>  
sc.helpers.addDelegatedListener(base_target, selector, event_type, handler, scope, use_capture)

<static>  
sc.helpers.addListener(target, event_type, handler, scope, use_capture)

add an event listener to a target (element, window, etc).

<static>  
sc.helpers.autolink(str, type, extra_code, maxlen)

This is a port of the CodeIgniter helper "autolink" to javascript.

<static>  
sc.helpers.autolinkTwitterHashtag(str, tpl)

turns twitter style hashtags ('#hashtag') into links by default, the template used is ##hashtag# pass the second param to give it a custom template

<static>  
sc.helpers.autolinkTwitterScreenname(str, tpl)

turns twitter style username refs ('@username') into links by default, the template used is @#username# pass the second param to give it a custom template

<static>  
sc.helpers.clone(oldObj)

<static>  
sc.helpers.closeWindow(opts)

<static>  
sc.helpers.containsScreenName(str, sn)

determines if a string contains the given screen name prefixed with a @ this is mainly used for determining if a message should be considered a 'mention'

<static>  
sc.helpers.copyFile(url, dest_url)

copy a file

<static>  
sc.helpers.crc32(str)

Javascript crc32 http://www.webtoolkit.info/

<static>  
sc.helpers.createDirectory(url)

make a new directory

<static>  
sc.helpers.createTempDirectory()

make a temporary directory

<static>  
sc.helpers.createTempFile()

make a temporary file

<static>  
sc.helpers.createXMLFromString(string)

Given a string, this returns an XMLDocument

<static>  
sc.helpers.dateToInt(entry_date, use_dateparse)

this returns milliseconds, not seconds!

<static>  
sc.helpers.debug(obj)

Helper to send a debug dump

<static>  
sc.helpers.defaults(defaults, passed)

Designed to fill in default values for an options argument passed to a function.

<static>  
sc.helpers.deJSON(json)

<static>  
sc.helpers.delegate()

Alias for sc.helpers.addDelegatedListener

<static>  
sc.helpers.deleteDirectory(url)

delete a directory

<static>  
sc.helpers.deleteFile(url)

delete a file

<static>  
sc.helpers.dump(obj, level)

A simple logging function

<static>  
sc.helpers.each(arr, f)

<static>  
sc.helpers.enJSON(any)

really just a simple wrapper for JSON.stringify

<static>  
sc.helpers.error(obj)

helper to send an error dump

<static>  
sc.helpers.escape_html(string)

<static>  
sc.helpers.extend(child, supertype)

We use this to do a form of inheritance, where the child inherits the methods and properties of the supertype

<static>  
sc.helpers.extractScreenNames(str, tpl)

<static>  
sc.helpers.extractURLs(str)

find URLs within the given string

<static>  
sc.helpers.fileExists(url)

does fileurl exist

<static>  
sc.helpers.fromHTMLSpecialChars(str)

Converts the following entities into regular chars: < > " '

<static>  
sc.helpers.getAppDir()

get the application's directory

<static>  
sc.helpers.getAppStorageDir()

returns the file URL for the app storage directory

<static>  
sc.helpers.getAppStoreDir()

Get the app storage directory

<static>  
sc.helpers.getAppVersion()

Returns the current application version string

<static>  
sc.helpers.getClipboardText()

Gets clipboard text

<static>  
sc.helpers.getCurrentLocation()

Stub

<static>  
sc.helpers.getCurrentWindow(opts)

<static>  
sc.helpers.getEncryptedValue(key)

Loads a value for a key from EncryptedLocalStore

<static>  
sc.helpers.getEventData(event_obj)

retrieves the data added to this event object

<static>  
sc.helpers.getFileContents(url)

Gets the contents of a file

<static>  
sc.helpers.getFileObject(url)

Returns the native file object

<static>  
sc.helpers.getModKey()

<static>  
sc.helpers.getOpenWindows(opts)

<static>  
sc.helpers.getOS()

Returns a string identifier for the OS.

<static>  
sc.helpers.getPlatform()

Returns a string identifier for the platform.

<static>  
sc.helpers.getPreferencesFile(name, create)

Get the preferences file

<static>  
sc.helpers.getRelativeTime(time_value, labels, use_dateparse)

<static>  
sc.helpers.getTimeAsInt()

<static>  
sc.helpers.getUserAgent()

Returns the user agent string for the app

<static>  
sc.helpers.htmlentities(string, quote_style)

<static>  
sc.helpers.htmlspecialchars(string, quote_style)

<static>  
sc.helpers.httpTimeToInt(entry_date, use_dateparse)

<static>  
sc.helpers.HTTPUploadFile(opts)

STUB opts = { content_type:'', // optional field_name:'', //optional, default to 'media; file_url:'', url:'', extra:{.

<static>  
sc.helpers.init_file(path, overwrite)

initializes a file at the given location.

<static>  
sc.helpers.initFile(url)

initializes a file at the given location.

<static>  
sc.helpers.isAIR()

<static>  
sc.helpers.isArray(obj)

<static>  
sc.helpers.isDirectory(url)

is given fileurl a directory

<static>  
sc.helpers.isFile(url)

is given fileurl a file

<static>  
sc.helpers.isLinux()

<static>  
sc.helpers.isMacOS()

<static>  
sc.helpers.isNumber(chk)

<static>  
sc.helpers.isOS(str)

checks to see if current platform is the one passed in.

<static>  
sc.helpers.isPlatform(str)

checks to see if current platform is the one passed in use one of the defined constants, like SPAZCORE_PLATFORM_AIR

<static>  
sc.helpers.isString(thing)

<static>  
sc.helpers.isTitanium()

<static>  
sc.helpers.isUUID(val)

Checks if the given value is an RFC 4122 UUID

<static>  
sc.helpers.iswebOS()

<static>  
sc.helpers.isWindows()

<static>  
sc.helpers.key_add(shortcut, func, opts)

this is really a wrapper for shortcut.add in shortcut.js

<static>  
sc.helpers.key_remove(keystroke)

this is really a wrapper for shortcut.remove in shortcut.js

<static>  
sc.helpers.listen()

Alias for sc.helpers.addListener

<static>  
sc.helpers.ltrim(str, chars)

<static>  
sc.helpers.makeClickable(str, opts)

Applies autolink, autolinkTwitterScreenname, autolinkTwitterHashtag

<static>  
sc.helpers.markAllAsRead(item_selector)

this marks all items in the selected set of elements as read.

<static>  
sc.helpers.MD5(string)

MD5 (Message-Digest Algorithm) http://www.webtoolkit.info/

<static>  
sc.helpers.moveFile(url, dest_url)

move a file

<static>  
sc.helpers.nl2br(str, breaktag)

<static>  
sc.helpers.note(obj)

helper to send a notice dump

<static>  
sc.helpers.objectToQueryString(object)

Takes a key/val pair object and returns a query string

<static>  
sc.helpers.openInBrowser(url)

Open a URL in the default system web browser

<static>  
sc.helpers.openWindow(opts)

<static>  
sc.helpers.pad(input, pad_length, pad_string, pad_type)

<static>  
sc.helpers.removeDelegatedListener(base_target, selector, event_type, handler, scope)

<static>  
sc.helpers.removeDuplicateElements(item_selector, remove_from_top)

This removes any duplicate items from a series of elements.

<static>  
sc.helpers.removeExtraElements(item_selector, max_items, remove_from_top)

This removes any extra items from a set of elements.

<static>  
sc.helpers.removeListener(target, event_type, handler, scope, use_capture)

removes an event listener on a target (element, window, etc).

<static>  
sc.helpers.replaceMultiple(str, map)

given as string and a mapping object, replace multiple values in the string (or vice versa) map should be of format { 'searchforme':'replacewithme', 'searchforme2':'replacewithme2', 'searchforme3':'replacewithme3' }

<static>  
sc.helpers.resolvePath(url, rel_path)

resolve a path against the given url

<static>  
sc.helpers.rtrim(str, chars)

<static>  
sc.helpers.setClipboardText(text)

Sets clipboard text

<static>  
sc.helpers.setEncryptedValue(key, val)

Sets a value in the EncryptedLocalStore of AIR

<static>  
sc.helpers.setFileContents(url, content, serialize)

sets the file contents

<static>  
sc.helpers.setUserAgent(uastring)

Sets the user agent string for the app

<static>  
sc.helpers.SHA1(msg)

Secure Hash Algorithm (SHA1) http://www.webtoolkit.info/

<static>  
sc.helpers.SHA256(s)

Secure Hash Algorithm (SHA256) http://www.webtoolkit.info/ Original code by Angel Marin, Paul Johnston.

<static>  
sc.helpers.stripTags(str)

Simple html tag remover

<static>  
sc.helpers.trigger()

Alias for sc.helpers.triggerCustomEvent

<static>  
sc.helpers.triggerCustomEvent(event_type, target, data, bubble)

This triggers a custom event using document.createEvent('Events') and target.dispatchEvent()

<static>  
sc.helpers.trim(str, chars)

Javascript trim, ltrim, rtrim http://www.webtoolkit.info/

<static>  
sc.helpers.undelegate()

Alias for sc.helpers.removeDelegatedListener

<static>  
sc.helpers.unlisten()

Alias for sc.helpers.removeListener

<static>  
sc.helpers.updateRelativeTimes(item_selector, time_attribute)

This updates relative times in elements.

<static>  
sc.helpers.UUID()

Generate a random uuid.

<static>  
sc.helpers.warn(obj)

helper to send a warn dump

<static>  
sc.helpers.xml2json(xml, extended)

Namespace Detail

sc.helpers

Method Detail

<static> sc.helpers.activateWindow(opts)

Defined in: window.js.

Parameters:
opts

<static> sc.helpers.addDelegatedListener(base_target, selector, event_type, handler, scope, use_capture)

Defined in: event.js.

Parameters:
{DOMElement} base_target
The base target where the delegated listener will be set-up
{string} selector
The CSS Selector that will be used to match incoming events. Matching is done with jQuery
{string} event_type
The event type
{Function} handler
a method that will take the event as a param, and "this" refers to target
{Object} scope Optional
the scope to execute the handler
{Boolean} use_capture Optional
Describe this parameter

<static> {function} sc.helpers.addListener(target, event_type, handler, scope, use_capture)

add an event listener to a target (element, window, etc). Uses target.addEventListener

Defined in: event.js.

Parameters:
{object} target
{string} event_type
{function} handler
a method that will take the event as a param, and "this" refers to target
{Object} scope Optional
the scope to execute the handler within (what "this" refers to)
{boolean} use_capture Optional
defaults to false
Returns:
{function} the handler that was passed -- or created, if we passed a scope. You can use this to remove the listener later on

<static> {string} sc.helpers.autolink(str, type, extra_code, maxlen)

This is a port of the CodeIgniter helper "autolink" to javascript. It finds and links both web addresses and email addresses. It will ignore links within HTML (as attributes or between tag pairs)

Defined in: string.js.

Parameters:
{string} str
{string} type
'email', 'url', or 'both' (default is 'both')
{boolean} extra_code
a string that will be inserted verbatim into tag
{integer} maxlen
the maximum length the link description can be (the string inside the tag)
Returns:
{string}

<static> {string} sc.helpers.autolinkTwitterHashtag(str, tpl)

turns twitter style hashtags ('#hashtag') into links by default, the template used is ##hashtag# pass the second param to give it a custom template

Defined in: string.js.

Parameters:
{string} str
{string} tpl
default is '##hashtag#'
Returns:
{string}

<static> {string} sc.helpers.autolinkTwitterScreenname(str, tpl)

turns twitter style username refs ('@username') into links by default, the template used is @#username# pass the second param to give it a custom template

Defined in: string.js.

Parameters:
{string} str
{string} tpl
default is '@#username#'
Returns:
{string}

<static> sc.helpers.clone(oldObj)

Defined in: javascript.js.

Parameters:
oldObj

<static> sc.helpers.closeWindow(opts)

Defined in: window.js.

Parameters:
opts

<static> {boolean} sc.helpers.containsScreenName(str, sn)

determines if a string contains the given screen name prefixed with a @ this is mainly used for determining if a message should be considered a 'mention'

Defined in: string.js.

Parameters:
{string} str
the string to check
{string} sn
the screen name to look for
Returns:
{boolean}

<static> sc.helpers.copyFile(url, dest_url)

copy a file

Defined in: file.js.

Parameters:
url
dest_url

<static> sc.helpers.crc32(str)

Javascript crc32 http://www.webtoolkit.info/

Defined in: hash.js.

Parameters:
str

<static> sc.helpers.createDirectory(url)

make a new directory

Defined in: file.js.

Parameters:
url

<static> sc.helpers.createTempDirectory()

make a temporary directory

Defined in: file.js.

<static> sc.helpers.createTempFile()

make a temporary file

Defined in: file.js.

<static> {XMLDocument} sc.helpers.createXMLFromString(string)

Given a string, this returns an XMLDocument

Defined in: xml.js.

Parameters:
{string} string
an xml string
Returns:
{XMLDocument}

<static> sc.helpers.dateToInt(entry_date, use_dateparse)

this returns milliseconds, not seconds!

Defined in: datetime.js.

Parameters:
entry_date
use_dateparse

<static> sc.helpers.debug(obj)

Helper to send a debug dump

Defined in: sys.js.

Parameters:
obj

<static> {object} sc.helpers.defaults(defaults, passed)

Designed to fill in default values for an options argument passed to a function. Merges the provided defaults with the passed object, using items from defaults if they don't exist in passed

Defined in: javascript.js.

Parameters:
{object} defaults
the default key/val pairs
{object} passed
the values provided to the calling method
Returns:
{object} a set of key/vals that have defaults filled-in

<static> sc.helpers.deJSON(json)

Defined in: json.js.

Parameters:
json

<static> sc.helpers.delegate()

Alias for sc.helpers.addDelegatedListener

Defined in: event.js.

<static> sc.helpers.deleteDirectory(url)

delete a directory

Defined in: file.js.

Parameters:
url

<static> sc.helpers.deleteFile(url)

delete a file

Defined in: file.js.

Parameters:
url

<static> sc.helpers.dump(obj, level)

A simple logging function

Defined in: sys.js.

Parameters:
obj
level

<static> sc.helpers.each(arr, f)

Defined in: javascript.js.

Parameters:
arr
f

<static> sc.helpers.enJSON(any)

really just a simple wrapper for JSON.stringify

Defined in: json.js.

Parameters:
any
js construct

<static> sc.helpers.error(obj)

helper to send an error dump

Defined in: sys.js.

Parameters:
obj

<static> sc.helpers.escape_html(string)

Defined in: string.js.

Parameters:
string

<static> sc.helpers.extend(child, supertype)

We use this to do a form of inheritance, where the child inherits the methods and properties of the supertype

Defined in: javascript.js.

Parameters:
{object} child
the child type
{object} supertype
the parent we inherit from
See:
https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Inheritance

<static> sc.helpers.extractScreenNames(str, tpl)

Defined in: string.js.

Parameters:
str
tpl

<static> sc.helpers.extractURLs(str)

find URLs within the given string

Defined in: string.js.

Parameters:
str

<static> sc.helpers.fileExists(url)

does fileurl exist

Defined in: file.js.

Parameters:
url

<static> sc.helpers.fromHTMLSpecialChars(str)

Converts the following entities into regular chars: < > " '

Defined in: string.js.

Parameters:
str

<static> sc.helpers.getAppDir()

get the application's directory

Defined in: file.js.

<static> sc.helpers.getAppStorageDir()

returns the file URL for the app storage directory

Defined in: file.js.

<static> sc.helpers.getAppStoreDir()

Get the app storage directory

Defined in: sys.js.

<static> sc.helpers.getAppVersion()

Returns the current application version string

Defined in: sys.js.

<static> sc.helpers.getClipboardText()

Gets clipboard text

Defined in: sys.js.

<static> sc.helpers.getCurrentLocation()

Stub

Defined in: location.js.

<static> sc.helpers.getCurrentWindow(opts)

Defined in: window.js.

Parameters:
opts

<static> sc.helpers.getEncryptedValue(key)

Loads a value for a key from EncryptedLocalStore

Defined in: sys.js.

Parameters:
key

<static> sc.helpers.getEventData(event_obj)

retrieves the data added to this event object

Defined in: event.js.

Parameters:
{DOMEvent} event_obj

<static> sc.helpers.getFileContents(url)

Gets the contents of a file

Defined in: file.js.

Parameters:
url

<static> sc.helpers.getFileObject(url)

Returns the native file object

Defined in: file.js.

Parameters:
url

<static> sc.helpers.getModKey()

Defined in: keyboard.js.

<static> sc.helpers.getOpenWindows(opts)

Defined in: window.js.

Parameters:
opts

<static> {String} sc.helpers.getOS()

Returns a string identifier for the OS.

Defined in: sys.js.

Returns:
{String} an identifier for the OS. See the SPAZCORE_OS_* variables

<static> {String} sc.helpers.getPlatform()

Returns a string identifier for the platform. Right now these checks are really, really basic

Defined in: sys.js.

Returns:
{String} an identifier for the platform

<static> sc.helpers.getPreferencesFile(name, create)

Get the preferences file

Defined in: sys.js.

Parameters:
name
create

<static> sc.helpers.getRelativeTime(time_value, labels, use_dateparse)

Defined in: datetime.js.

Parameters:
time_value
labels
use_dateparse

<static> sc.helpers.getTimeAsInt()

Defined in: datetime.js.

<static> sc.helpers.getUserAgent()

Returns the user agent string for the app

Defined in: sys.js.

<static> sc.helpers.htmlentities(string, quote_style)

Defined in: string.js.

Parameters:
string
quote_style

<static> sc.helpers.htmlspecialchars(string, quote_style)

Defined in: string.js.

Parameters:
string
quote_style

<static> sc.helpers.httpTimeToInt(entry_date, use_dateparse)

Defined in: datetime.js.

Parameters:
entry_date
use_dateparse

<static> sc.helpers.HTTPUploadFile(opts)

STUB opts = { content_type:'', // optional field_name:'', //optional, default to 'media; file_url:'', url:'', extra:{...} }

Defined in: network.js.

Parameters:
opts

<static> sc.helpers.init_file(path, overwrite)

initializes a file at the given location. set overwrite to true to clear out an existing file. returns the air.File object or false

Defined in: sys.js.

Parameters:
path
overwrite

<static> sc.helpers.initFile(url)

initializes a file at the given location. set overwrite to true to clear out an existing file. returns true or false

Defined in: file.js.

Parameters:
url

<static> sc.helpers.isAIR()

Defined in: sys.js.

<static> sc.helpers.isArray(obj)

Defined in: javascript.js.

Parameters:
obj

<static> sc.helpers.isDirectory(url)

is given fileurl a directory

Defined in: file.js.

Parameters:
url

<static> sc.helpers.isFile(url)

is given fileurl a file

Defined in: file.js.

Parameters:
url

<static> sc.helpers.isLinux()

Defined in: sys.js.

<static> sc.helpers.isMacOS()

Defined in: sys.js.

<static> sc.helpers.isNumber(chk)

Defined in: javascript.js.

Parameters:
chk

<static> sc.helpers.isOS(str)

checks to see if current platform is the one passed in. Use one of the defined constants, like SPAZCORE_OS_WINDOWS

Defined in: sys.js.

Parameters:
{String} str
the platform you're checking for

<static> sc.helpers.isPlatform(str)

checks to see if current platform is the one passed in use one of the defined constants, like SPAZCORE_PLATFORM_AIR

Defined in: sys.js.

Parameters:
{String} str
the platform you're checking for

<static> sc.helpers.isString(thing)

Defined in: javascript.js.

Parameters:
thing

<static> sc.helpers.isTitanium()

Defined in: sys.js.

<static> sc.helpers.isUUID(val)

Checks if the given value is an RFC 4122 UUID

Defined in: hash.js.

Parameters:
val

<static> sc.helpers.iswebOS()

Defined in: sys.js.

<static> sc.helpers.isWindows()

Defined in: sys.js.

<static> sc.helpers.key_add(shortcut, func, opts)

this is really a wrapper for shortcut.add in shortcut.js

Defined in: keyboard.js.

Parameters:
{string} shortcut
The shortcut key combination should be specified in this format: Modifier[+Modifier..]+Key
{Object} func
The function to be called when key is pressed
{Object} opts
A hash of options
{string} opts.type Optional
The event type - can be 'keydown','keyup','keypress'. Default: 'keydown'
{Boolean} opts.disable_in_input Optional
If this is set to true, keyboard capture will be disabled in input and textarea fields. Default is TRUE
{Object} opts.target Optional
The dom node that should be watched for the keyboard event. Default is the document element
{Boolean} opts.propagate Optional
If the key event should propagate. Default is FALSE
{Number} opts.keycode Optional
Watch for the given keycode

<static> sc.helpers.key_remove(keystroke)

this is really a wrapper for shortcut.remove in shortcut.js

Defined in: keyboard.js.

Parameters:
keystroke

<static> sc.helpers.listen()

Alias for sc.helpers.addListener

Defined in: event.js.

<static> sc.helpers.ltrim(str, chars)

Defined in: string.js.

Parameters:
str
chars

<static> sc.helpers.makeClickable(str, opts)

Applies autolink, autolinkTwitterScreenname, autolinkTwitterHashtag

Defined in: string.js.

Parameters:
{string} str
{oobject} opts
Opts structure: { 'autolink': { 'type' :'both', (email, url, or both) 'extra_code':'', 'maxlen' :20 }, 'screenname': { 'tpl':'' // should contain macro '#username#' }, 'hashtag': { 'tpl':'' // should contain macros '#hashtag#' and '#hashtag_enc#' } }

<static> sc.helpers.markAllAsRead(item_selector)

this marks all items in the selected set of elements as read. It does this by removing the 'new' class

Defined in: view.js.

Parameters:
{string} item_selector
Requires:
jQuery

<static> sc.helpers.MD5(string)

MD5 (Message-Digest Algorithm) http://www.webtoolkit.info/

Defined in: hash.js.

Parameters:
string

<static> sc.helpers.moveFile(url, dest_url)

move a file

Defined in: file.js.

Parameters:
url
dest_url

<static> {string} sc.helpers.nl2br(str, breaktag)

Defined in: string.js.

Parameters:
{string} str
the string in which we're converting linebreaks
{string} breaktag Optional
the tag used to break up lines. defaults to
Returns:
{string} the string with linebreaks converted to breaktags

<static> sc.helpers.note(obj)

helper to send a notice dump

Defined in: sys.js.

Parameters:
obj

<static> sc.helpers.objectToQueryString(object)

Takes a key/val pair object and returns a query string

Defined in: url.js.

Parameters:
object

<static> sc.helpers.openInBrowser(url)

Open a URL in the default system web browser

Defined in: sys.js.

Parameters:
url

<static> sc.helpers.openWindow(opts)

Defined in: window.js.

Parameters:
opts

<static> sc.helpers.pad(input, pad_length, pad_string, pad_type)

Defined in: string.js.

Parameters:
{string} input
the input string
{number} pad_length
the length to pad the string
{string} pad_string
the string to pad with
{string} pad_type
STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH. Default is STR_PAD_RIGHT

<static> sc.helpers.removeDelegatedListener(base_target, selector, event_type, handler, scope)

Defined in: event.js.

Parameters:
{DOMElement} base_target
The base target where the delegated listener will be set-up
{string} selector
The CSS Selector that will be used to match incoming events. Matching is done with jQuery
{string} event_type
The event type
{Function} handler
a method that will take the event as a param, and "this" refers to target
{Object} scope Optional
the scope to execute the handler

<static> sc.helpers.removeDuplicateElements(item_selector, remove_from_top)

This removes any duplicate items from a series of elements. Intended to be used for limiting the sice of timelines

Defined in: view.js.

Parameters:
{string} item_selector
a jquery-compatible selector to get items
{boolean} remove_from_top
whether or not to remove extra items from the top. default is FALSE

<static> sc.helpers.removeExtraElements(item_selector, max_items, remove_from_top)

This removes any extra items from a set of elements. Intended to be used for limiting the size of timelines This does NOT remove bound event listeners in order to increase speed. Be careful!

Defined in: view.js.

Parameters:
{string} item_selector
a jquery-compatible selector to get items
{integer} max_items
the max # of item we should have
{boolean} remove_from_top
whether or not to remove extra items from the top. default is FALSE
Requires:
jQuery

<static> sc.helpers.removeListener(target, event_type, handler, scope, use_capture)

removes an event listener on a target (element, window, etc). uses Uses target.removeEventListener Note that you must match all of the parameters to successfully remove the listener

Defined in: event.js.

Parameters:
{object} target
{string} event_type
{function} handler
a method that will take the event as a param, and "this" refers to target
{Object} scope
the scope to execute the handler
{boolean} use_capture
defaults to false

<static> {string} sc.helpers.replaceMultiple(str, map)

given as string and a mapping object, replace multiple values in the string (or vice versa) map should be of format { 'searchforme':'replacewithme', 'searchforme2':'replacewithme2', 'searchforme3':'replacewithme3' }

Defined in: string.js.

Parameters:
{string} str
{object} map
Returns:
{string}

<static> sc.helpers.resolvePath(url, rel_path)

resolve a path against the given url

Defined in: file.js.

Parameters:
url
rel_path

<static> sc.helpers.rtrim(str, chars)

Defined in: string.js.

Parameters:
str
chars

<static> sc.helpers.setClipboardText(text)

Sets clipboard text

Defined in: sys.js.

Parameters:
text

<static> sc.helpers.setEncryptedValue(key, val)

Sets a value in the EncryptedLocalStore of AIR

Defined in: sys.js.

Parameters:
key
val

<static> sc.helpers.setFileContents(url, content, serialize)

sets the file contents

Defined in: file.js.

Parameters:
url
content
serialize

<static> sc.helpers.setUserAgent(uastring)

Sets the user agent string for the app

Defined in: sys.js.

Parameters:
uastring

<static> sc.helpers.SHA1(msg)

Secure Hash Algorithm (SHA1) http://www.webtoolkit.info/

Defined in: hash.js.

Parameters:
msg

<static> sc.helpers.SHA256(s)

Secure Hash Algorithm (SHA256) http://www.webtoolkit.info/ Original code by Angel Marin, Paul Johnston.

Defined in: hash.js.

Parameters:
s

<static> {string} sc.helpers.stripTags(str)

Simple html tag remover

Defined in: string.js.

Parameters:
{string} str
Returns:
{string}

<static> sc.helpers.trigger()

Alias for sc.helpers.triggerCustomEvent

Defined in: event.js.

<static> sc.helpers.triggerCustomEvent(event_type, target, data, bubble)

This triggers a custom event using document.createEvent('Events') and target.dispatchEvent()

Defined in: event.js.

Parameters:
{string} event_type
{DOMElement} target
the target for the event (element, window, etc)
{object} data
data to pass with event. it is always passed as the second parameter to the handler (after the event object)
{boolean} bubble
whether the event should bubble or not. defaults to true

<static> sc.helpers.trim(str, chars)

Javascript trim, ltrim, rtrim http://www.webtoolkit.info/

Defined in: string.js.

Parameters:
str
chars

<static> sc.helpers.undelegate()

Alias for sc.helpers.removeDelegatedListener

Defined in: event.js.

<static> sc.helpers.unlisten()

Alias for sc.helpers.removeListener

Defined in: event.js.

<static> sc.helpers.updateRelativeTimes(item_selector, time_attribute)

This updates relative times in elements. Each element has to have an attribute that contains the created_at value provided by Twitter

Defined in: view.js.

Parameters:
{string} item_selector
the jQuery selector for the elements which will contain the relative times
{string} time_attribute
the attribute of the element that contains the created_at value
Requires:
jQuery

<static> sc.helpers.UUID()

Generate a random uuid. USAGE: Math.uuid(length, radix) length - the desired number of characters radix - the number of allowable values for each character. EXAMPLES: // No arguments - returns RFC4122, version 4 ID >>> Math.uuid() "92329D39-6F5C-4520-ABFC-AAB64544E172" // One argument - returns ID of the specified length >>> Math.uuid(15) // 15 character ID (default base=62) "VcydxgltxrVZSTV" // Two arguments - returns ID of the specified length, and radix. (Radix must be <= 62) >>> Math.uuid(8, 2) // 8 character ID (base=2) "01001010" >>> Math.uuid(8, 10) // 8 character ID (base=10) "47473046" >>> Math.uuid(8, 16) // 8 character ID (base=16) "098F4D35"

Defined in: hash.js.

<static> sc.helpers.warn(obj)

helper to send a warn dump

Defined in: sys.js.

Parameters:
obj

<static> sc.helpers.xml2json(xml, extended)

Defined in: json.js.

Parameters:
xml
extended