Class: ComponentHelper

ComponentHelper

new ComponentHelper(context, data) → {ComponentHelper}

HOMEWORKS Helper constructor, This is helping to treat DOM Elements or JS operators.

Parameters:
Name Type Description
context ComponentMethod

HOMEWORKS ComponentMethod Context.

data ComponentData.store

HOMEWORKS ComponentData store for get unique id.

Author:
Source:
See:
  • Refer an example document here.
Returns:
Type
ComponentHelper

Methods

bind(element, type, callback, initialize) → {undefined}

It will attach an event to your element, Use this function instead jQuery.bind.

Parameters:
Name Type Description
element jQuery

jQuery object for attach event.

type String

Event type name.

callback function

The callback function which fired when event triggered.

initialize Boolean

If this parameter is true, The event is triggered once automatically.

Source:
Returns:
Type
undefined

getIdentifier() → {String}

You can get unique id for set each of component by using this function.

Source:
Returns:
Type
String

invoke(name, callback, time, invoke) → {Boolean}

This function will invoke promiss request that you created before.

Parameters:
Name Type Description
name String

Promiss name for invoke a request.

callback function

The callback when promiss is done.

time Number

A millisecond time for promiss.

invoke function

The callback when invoke request be received.

Source:
Returns:
Type
Boolean

log(message, code) → {undefined}

The logger of HOMEWORKS Frameworks, Use this instead console.log.

Parameters:
Name Type Description
message String

String error message or Exception object.

code String

Error code or number.

Source:
Returns:
Type
undefined

parseTemplate(key, map) → {String}

This function find template that you declared on ComponentMethod's templates array, and than replace it using a key what you gave.

Parameters:
Name Type Description
key String

The template key.

map Object

The template object.

Source:
Returns:
Type
String

promise(name, callback, time, invoke) → {Number}

Promiss is helping to make a schedule, It is similar like setTimeout.

Parameters:
Name Type Description
name String

Promiss name for control.

callback function

The callback when promiss is done.

time Number

A millisecond time for promiss.

invoke function

The callback when invoke request be received.

Source:
Returns:

setTimeout number.

Type
Number

trigger(element, type, value) → {undefined}

This function will trigger an event, Use this function instead jQuery.trigger.

Parameters:
Name Type Description
element jQuery

jQuery object for trigger event.

type String

Event type name.

value Any

Extra values for sending the binder function.

Source:
Returns:
Type
undefined

triggerHandler(element, type, value) → {undefined}

This function will trigger an event "only logically", Use this function instead jQuery.triggerHandler.

Parameters:
Name Type Description
element jQuery

jQuery object for trigger event logically.

type String

Event type name.

value Any

Extra values for sending the binder function.

Source:
Returns:
Type
undefined

unbind(element, type) → {undefined}

Deattach event from the jQuery object, Use this function instead jQuery.unbind.

Parameters:
Name Type Description
element jQuery

jQuery object for deattach event.

type String

Event type name.

Source:
Returns:
Type
undefined