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. |
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. |
Returns:
- Type
- undefined
getIdentifier() → {String}
You can get unique id for set each of component by using this function.
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
Returns:
- Type
- undefined