# Class: module:core/utils/helper

## module:core/utils/helper

#### new module:core/utils/helper(context, data) → {Helper}

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

##### Parameters:

Name | Type | Description
--- | --- | ---
`context` | Method | HOMEWORKS Method Context.
`data` | ComponentData.store | HOMEWORKS ComponentData store for get unique id.

Author:
  - Kenneth
Source:
  - helper.js, line 20
See:
  - Refer an example document here.

##### Returns:

Type
  Helper

### 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:
  - helper.js, line 163

##### Returns:

Type
  undefined

#### getIdentifier() → {String}

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

Source:
  - helper.js, line 147

##### 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:
  - helper.js, line 87

##### 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:
  - helper.js, line 110

##### Returns:

Type
  undefined

#### parseTemplate(key, map) → {String}

This function find template that you declared on Method'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:
  - helper.js, line 133

##### 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:
  - helper.js, line 51

##### Returns:

setTimeout number.

Type
  Number

#### randomString(length) → {String}

Get random string that made 0-9 numbers, lower/upper case alphabets.

##### Parameters:

Name | Type | Description
--- | --- | ---
`length` | Number | Random string length.

Source:
  - helper.js, line 32

##### Returns:

Random string.

Type
  String

#### 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:
  - helper.js, line 211

##### 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:
  - helper.js, line 224

##### 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:
  - helper.js, line 199

##### Returns:

Type
  undefined