A quick rant.
- PouchDB is slow, because it doesn't use bare-metal IndexedDB
OK, first off I want to point out the CanIUse table for IndexedDB. Go ahead, look at it. I'll wait.
| angular.module('swag', []) | |
| .controller('MainController', function(MyApi) { | |
| $scope.submit = function(data) { | |
| MyApi.get(data).then(function(data) { | |
| // redirect or some action here | |
| alert(data); | |
| }) | |
| .catch(function(err) { | |
| // ui logic belogs here | |
| alert(err); |
A quick rant.
OK, first off I want to point out the CanIUse table for IndexedDB. Go ahead, look at it. I'll wait.
While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.
Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.
| module.exports = function(config) { | |
| config.set({ | |
| basePath: '', | |
| frameworks: ['jasmine'], | |
| files: [ | |
| // lib | |
| './app/lib/angular/angular.js', | |
| './app/lib/**/angular-*.js', | |
| The MIT License (MIT) | |
| Copyright (c) 2014 Tomas Kafka | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
| !function(i,o){i("Keen","/3.1.0/keen.min.js",o)}(function(a,b,c){var d,e,f;c["_"+a]={},c[a]=function(b){c["_"+a].clients=c["_"+a].clients||{},c["_"+a].clients[b.projectId]=this,this._config=b},c[a].ready=function(b){c["_"+a].ready=c["_"+a].ready||[],c["_"+a].ready.push(b)},d=["addEvent","setGlobalProperties","trackExternalLink","on"];for(var g=0;g<d.length;g++){var h=d[g],i=function(a){return function(){return this["_"+a]=this["_"+a]||[],this["_"+a].push(arguments),this}};c[a].prototype[h]=i(h)}e=document.createElement("script"),e.async=!0,e.src=b,f=document.getElementsByTagName("script")[0],f.parentNode.insertBefore(e,f)},this); | |
| (function(i,o){i("Keen","/3.1.0/keen.min.js",o);}(function(t,h,x){ | |
| // t = context | |
| // h = file | |
| // x = context | |
| // console.log(t,h,x===window); | |
| var methods, script, tag; | |
| // _Keen cache |
| /** | |
| * VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units | |
| * | |
| * To overcome this, create media queries that target the width, height, and orientation of iOS devices. | |
| * It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing | |
| * the height of element `.foo` —which is a full width and height cover image. | |
| * | |
| * iOS Resolution Quick Reference: http://www.iosres.com/ | |
| */ | |
| /** | |
| * the HTML5 autofocus property can be finicky when it comes to dynamically loaded | |
| * templates and such with AngularJS. Use this simple directive to | |
| * tame this beast once and for all. | |
| * | |
| * Usage: | |
| * <input type="text" autofocus> | |
| * | |
| * License: MIT | |
| */ |