polyfills

Polyfill file input with accept capture (using getUserMedia to capture?)

放肆的年华 提交于 2019-12-05 08:19:51
I want to enable image (& audio & video) uploads in a survey framework. To do so, input file is nearly sufficient for my purposes. On some mobile browsers <input type="file" accept="image/*;capture=camera"> is a really simple way of letting users choose to upload an existing image or to take a new one. Of course the UI for viewing and choosing among the pictures is provided too. Desktop browsers did not go this route. Instead, some pretty nice stuff seems to be possible using getUserMedia() . I did not find any working examples that upload the collected user-media to the server (e.g. I found

Spread Operator not working for Redux/ES6 based sample

只谈情不闲聊 提交于 2019-12-05 08:18:59
I am trying to understand Redux online tutorials that are posted by Dan Abramov. At present I am on the following sample: Reducer composition with Arrays Here is my practice code following the above sample: // Individual TODO Reducer const todoReducer = (state, action) => { switch(action.type) { case 'ADD_TODO': return { id: action.id, text: action.text, completed: false }; case 'TOGGLE_TODO': if (state.id != action.id) return state; // This not working /* return { ...state, completed: !state.completed }; */ //This works var newState = {id: state.id, text: state.text, completed: !state

Vue 3 CLI - How to add babel polyfill for Object.entries

家住魔仙堡 提交于 2019-12-05 07:01:55
I have a dependency (vue2-google-maps) which is causing issues with my Vue app in older browsers, throwing an error with Object.entries . Reading the Vue CLI Docs on polyfills , I see it mention trying to load the polyfill in babel.config.js . My babel.config.js : module.exports = { presets: [ ['@vue/app', { polyfills: [ 'es6.object' ] }] ] } Throws an error: Module build failed (from ./node_modules/babel-loader/lib/index.js): TypeError: [BABEL] /PROJECT_DIR/src/main.js: Cannot read property 'android' of undefined (While processing: "/PROJECT_DIR/node_modules/@vue/babel-preset-app/index.js")

Why do console.log() polyfills not use Function.apply()?

為{幸葍}努か 提交于 2019-12-05 06:22:30
I've been looking at some of the popular console.log() wrappers/polyfills: Paul Irish's Ben Alman's Craig Patik's I notice that all of them accept multiple arguments , but they all do something like this: console.log(arguments); Which results in output like this (in Chrome): Whereas, at least in a modern browser like Chrome or Firefox, console.log() also accepts multiple arguments, so that this would produce (IMHO) superior output: console.log.apply(console, arguments) Which results in output like this (in Chrome): Is there any particular reason why I should avoid using console.log.apply()

Jquery Validate Incompatible with Placeholder Polyfill? [IE9 Bug]

﹥>﹥吖頭↗ 提交于 2019-12-05 05:42:23
问题 I'm currently using the Placeholder Polyfill by Mathias Bynens in combination with the jquery.validate plugin (v1.11.1) and am running into a frustrating error with Internet Explorer 9 . I cannot get required field validation to work on my type="password" fields if they have a non-empty placeholder attribute defined. Once a value is input and the placeholder text disappears, the remaining validation works fine. Live Demo of this code can be found here JS $('input').placeholder(); // init

Add polyfill code in Angular 2

隐身守侯 提交于 2019-12-05 05:08:53
How would I add code of a polyfill in a Angular 2 cli-project? For example, I would like to use the following polyfill from Mozilla MDN : if (!Array.prototype.includes) { Object.defineProperty(Array.prototype, 'includes', { value: function(searchElement, fromIndex) { if (this == null) { throw new TypeError('"this" is null or not defined'); } var o = Object(this); var len = o.length >>> 0; if (len === 0) { return false; } var n = fromIndex | 0; var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); while (k < len) { if (o[k] === searchElement) { return true; } k++; } return false; } }); } I found

how can I use babel polyfill to support all IE11 issues with gulp

筅森魡賤 提交于 2019-12-05 03:43:35
I've been piecing together support for IE11 by adding plugins for transform-object-assign and array-includes and now I'm getting a symbol error for using for of loops. Instead of just tackling them one at a time, is it possible for me to work babel polyfill into my build below and future proof it? I've read several related questions but still am not clear on how I'd fit babel-polyfill into the gulp build below: return gulp.src(input) // Grab the input files .pipe($.babel({ presets: ['es2015'], // transform ES6 to ES5 with Babel plugins: ['transform-object-assign','array-includes'] })) .pipe($

IE 11 compatibility errors using Angular 5

一曲冷凌霜 提交于 2019-12-05 01:34:26
问题 I have build my Angular application then run it in server. I got errors that where not shown in localhost. Unable to get property 'onHover' of undefined or null reference. File Chart.min.js, ligne : 10, colonne : 115187 Error “SCRIPT 1028 Expected identifier, string or number” File polyfills.bundle.js, ligne : 6399, colonne : 5 . Object doesn't support property or method 'querySelector File styles.bundle.js, ligne : 215, colonne : 2 Expected identifier File: vendor.bundle.js, ligne : 3169,

Array Reduce Polyfill Explanation

安稳与你 提交于 2019-12-05 01:18:37
问题 Apologize in advance for lengthy post. I am trying to understand array reduce polyfill provided by MDN. I could not understand some lines in the polyfill can you explain it please. Below is the code if (!Array.prototype.reduce) { Object.defineProperty(Array.prototype, 'reduce', { value: function(callback /*, initialValue*/) { if (this === null) { throw new TypeError( 'Array.prototype.reduce ' + 'called on null or undefined' ); } if (typeof callback !== 'function') { throw new TypeError(

TS2304: cannot find name require and process

偶尔善良 提交于 2019-12-04 23:50:31
When I want to start my angular 2 app using "npm start". I get errors: I tried a lot of "solutions" from internet, but nothing works. My versions: npm - 4.1.2 typings - 2.1.0 node - 7.5.0 tsconfig.json { "compilerOptions": { "target": "es6", "module": "commonjs", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "lib": ["es2015", "dom"], "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true } } polyfills.ts import 'core-js/es6'; import 'core-js/es7/reflect'; require('zone.js/dist/zone'); if (process.env.ENV === 'production') {