![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
pentatrion-lib
Advanced tools
jsonFetch/formFetch sans body est-ce gênant ?
Fonctions que j'utilise pour mes projets. Pourquoi ne pas les rendre publiques ?
import { downloadHelper, dateHelper, apiHelper } from "pentatrion-lib";
let dateTime = new Date();
dateHelper.toIsoString(dateTime);
// 2021-04-12
dateHelper.toIsoString(dateTime, true);
// 2021-04-12T11-40
downloadHelper.stringToSlug("Salut les élèves !");
// salut-les-eleves-
downloadHelper.downloadFromUrl("/sav.svg", "sac.svg");
// ok
// attention aux problèmes de cors si la requête est effectuée vers un autre domaine
formFetch(
url,
{
body: jsonObj | formData,
// others
},
(xRequestedWidth = false)
);
on envoie par POST (surcharger si on souhaite une autre méthode) des données FormData (application/x-www-form-urlencoded, multipart/form-data) meilleure compatibilité pour les cors. par contre c'est compliqué si on souhaite envoyer un objet avec une profondeur plus grande que 1.
jsonFetch
jsonFetch(
url,
{
body: jsonObj | formData,
// others
},
(xRequestedWidth = false)
);
Envoie une requête fetch avec un body de type JSON.
On peut spécifier un contenu de type FormData / Objet, celui-ci sera sérialisé avant d'être envoyé. pratique si on a un objet avec de la profondeur. niveau CORS nécessite une requête OPTIONS car le Content-Type est application/json
.
Retourne une promesse avec l'objet déjà parsé en JSON s'il est de type application/json sinon renvoie l'objet response.
Si la requête échoue (status non compris entre 200 et 299) soulève une Exception de type ApiError
qui contient 2 propriétés : status
et message
. message est complété en essayant de voir si la réponse au format JSON possède ces champs :
let title = data.err || data.title || data.detail || "Erreur serveur";
on applique Animator sur un élément masqué avec display: none. afin de lui appliquer une transition à la vue
<nav id="nav" class="hide" data-transition-name="navbar">...</nav>
.hide {
display: none !important;
}
.navbar-enter-active,
.navbar-leave-active {
transition: all 0.5s ease;
}
.navbar-enter,
.navbar-leave-to {
opacity: 0;
}
.navbar-enter-active --------- | .navbar-leave-active ---------
.navbar-enter .navbar-enter-to | .navbar-leave .navbar-leave-to
.hide----- | .hide----
import { Animator } from "pentatrion-lib";
let animator = new Animator({
inactiveClass: "hide",
// can be surcharged with "data-transition-name"
transitionName: "transition",
});
animator.animEnter(elt);
animator.animLeave(elt);
FAQs
Des fonctions utiles pour vos projets
The npm package pentatrion-lib receives a total of 0 weekly downloads. As such, pentatrion-lib popularity was classified as not popular.
We found that pentatrion-lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.