Created
June 30, 2018 01:33
-
-
Save furenku/be93e8d37364891668e59c16a2e7d8f7 to your computer and use it in GitHub Desktop.
clase js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Ejercicio js | |
| - Explicar Qué es AJAX -> cargado dinamico | |
| - menu scrollspy autoscroll | |
| - Calculadora: Closure | |
| calc = (func(){ | |
| // privada | |
| function init(){} | |
| return { | |
| metodo1: func... | |
| metodo2: func... | |
| } | |
| })() | |
| - Consumo de API: Grid de SW | |
| - Blog | |
| - Crear API falsa JSONs | |
| - validar json | |
| - stringify | |
| - localStorage json | |
| - Player | |
| - Ejercicio History + AJAX | |
| - Mostrar uso Babel y un par de intros a ES6 | |
| // mostrar como scope incluidos automaticamente en arrow functions | |
| podria ser window, o un closure o clase | |
| ---------- | |
| promise = new Promise( function( resolve, reject) { | |
| setTimeout(resolve,1000) | |
| }) | |
| promise | |
| .then(function(){ | |
| console.log("wait done") | |
| }) | |
| .catch(function(){}) | |
| resolve( JSON.parse(this.responseText)) | |
| reject( new Error ( this | |
| get(...) | |
| .then(res1=>{ | |
| return get(...) | |
| }) | |
| .then(res2=>{ | |
| }) | |
| .catch((err)=>manejarError(err)) | |
| fetch(url) | |
| .then(res=>{}) | |
| .catch(err=>{}) | |
| fetch(url) | |
| .then(response=>response.json()) | |
| .then(json=>{ | |
| myvar = json | |
| return fetch(otrourl) | |
| }) | |
| .then(response=>response.json()) | |
| .then(response=>{}) | |
| async function algo() { | |
| // res es una promesa | |
| const res = await fetch(url) | |
| const nombreObjeto = await res.json | |
| } | |
| async function callAPI() { | |
| try { | |
| const res = await fetch('https://swapi.co/api/people/1') | |
| const persona = await res.json() | |
| const mundo = await fetch( persona.homeworld ) | |
| const resultado = await mundo.json() | |
| console.log( resultado ) | |
| if( !resultado ) | |
| throw new Error("un error") | |
| } catch(error) { | |
| console.log(error) | |
| } | |
| } | |
| callAPI() | |
| babel-polyfill |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ---- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment