Classes
Namespaces
Members
(static, constant) exports.KeyboardManagerInstance
- Source
(static, constant) exports.KEYS
Keys code for the keyboard
- Source
(static, constant) exports.MouseButton
Mouse button keys
- Source
(static, constant) exports.MouseManagerInstance
- Source
const { x, y } = MouseManagerInstance;
console.log(x, y);
(static, constant) exports.ParticlesInstance
- Source
Methods
(static) deleteAllChildDom(domElement)
Eliminate all child elements of a choice parent element. For example: delete all dom
- .
Name | Type | Description |
---|---|---|
domElement | HTMLElement | The HTML element to exclude all children |
- Source
(static) exports.exportFile(data, filename, type) → {void}
Create a file and auto downloads the file to user computer
Name | Type | Description |
---|---|---|
data | any | the content to export |
filename | string | the name of the exported file |
type | string | type of the exported file like "txt" |
- Source
- Type:
- void
(static) getUrlParameter(key) → {string}
Get a value from a query parameter from the current URL
Name | Type | Description |
---|---|---|
key | string | The key of the query parameter |
- Source
Returns the value of the key
- Type:
- string
URL: http://localhost:8080/?name=Silva
getUrlParameter("name"); // Silva
(static) notification(options) → {void}
Display a pop up im the DOM with the given text
Example: https://codesandbox.io/s/201flaviosilva-utils-notification-g3nk0v
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | Object | The options for the pop up Properties
|
- Source
- Type:
- void
notification({ text: "notification" });
notification({
text: "My nice text",
animated: false,
animationTime: 5,
closeButton: true,
endPosition: 250,
style: { border: "10px solid rgb(0, 255, 100)", },
textStyle: { textTransform: "uppercase", },
buttonStyle: { backgroundColor: "red" },
});
(static) printObjectInDOM(object, parentopt)
Print JavaScript Object In HTML Dom
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
object | Object | JavaScript Object to print in the dom | ||
parent | HTMLElement | <optional> | document.body | DOM element to print |
- Source
- See
https://jsfiddle.net/201flaviosilva/mbnz3p7y/
const myObject = {
name: "Sistema Solar",
numberStarts: 1,
terra: {
speed: 29.783,
moons: ["Lua"],
temperature: {
min: 93.2,
max: 57.8,
average: 14,
}
},
};
printObjectInDOM(myObject, document.getElementById("myDomElement"));
(static) toggleFullScreen(element) → {void}
- If a given element is not in full screen, starts the full-screen mode and focus on the element.
- If the document is already in full screen mode, stop.
Name | Type | Description |
---|---|---|
element | HTMLElement | the DOM element to put in full screen |
- Source
- Type:
- void
toggleFullScreen();
toggleFullScreen(document.getElementById("myElement"));
```html
<!--- html --->
<button id="toggle">Toggle</button>
```
```js
// js
import { toggleFullScreen } from "201flaviosilva-utils";
document.getElementById("toggle").addEventListener("click", () => {
toggleFullScreen(document.getElementById("toggle"));
});
```