|
|
## Helpers fonctions
|
|
|
|
|
|
Those function are inclued in the core.
|
|
|
|
|
|
| Function | Parameters | Description |
|
|
|
| -------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
|
| `uniqID` | | create an uniq ID, used for example to associate input with label |
|
|
|
| `stringToDom` | `html` | parse html string and return DOM fragment |
|
|
|
| `evalTemplateString` | `str, variables = {}` | eval a string as an es6 template string. example: `evalTemplateString('name: ${first} ${last}', {first: 'John', last: 'Doe'})` |
|
|
|
| `importCSS` | `[...stylesheets]` | add style in document if not present |
|
|
|
| `importJS` | `[...script]` | add script in document if not present | |
|
|
\ No newline at end of file |
|
|
| `importJS` | `[...script]` | add script in document if not present |
|
|
|
|
|
|
|
|
|
___If you're writing a component___
|
|
|
|
|
|
Creating a component, you should import those function like this :
|
|
|
|
|
|
```js
|
|
|
import { Helpers } from "https://unpkg.com/@startinblox/core@0.9";
|
|
|
```
|
|
|
|
|
|
You should always use `importCSS` and `importJS` to make your extra importation. Otherwise, you'll get this king of message :
|
|
|
|
|
|
```
|
|
|
Le chargement du module à l’adresse « https://the/road/to/your/extra/script » a été bloqué en raison d’un type MIME interdit (« text/html »).
|
|
|
``` |
|
|
\ No newline at end of file |