Skip to content

Instantly share code, notes, and snippets.

@orf
Last active June 14, 2017 12:48
Show Gist options
  • Save orf/625abf7d2eff52a579bf2d82c1eceadc to your computer and use it in GitHub Desktop.
Save orf/625abf7d2eff52a579bf2d82c1eceadc to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
import fetch from 'fetch';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
noDnsFailed: null,
noDnsFailedRealFetch: null,
SSLFailed: null,
SSLFailedRealFetch: null,
init(){
this._super(...arguments);
fetch('http://asdsadsadasdasdasdasdsadasdasdasdasd.xyas').then(
()=>{this.set('noDnsFailed', false)},
()=>{this.set('noDnsFailed', true)});
fetch('https://untrusted-root.badssl.com/').then(
()=>{this.set('SSLFailed', false)},
()=>{this.set('SSLFailed', true)});
window.fetch('http://asdsadsadasdasdasdasdsadasdasdasdasd.xyas').then(
()=>{Ember.run.next(()=>this.set('noDnsFailedRealFetch', false))},
()=>{Ember.run.next(()=>this.set('noDnsFailedRealFetch', true))});
window.fetch('https://untrusted-root.badssl.com/').then(
()=>{Ember.run.next(()=>this.set('SSLFailedRealFetch', false))},
()=>{Ember.run.next(()=>this.set('SSLFailedRealFetch', true))});
}
});
<h1>Welcome to {{appName}}</h1>
<br>
Failures:
<br>
DNS pollyfill: {{noDnsFailed}}<br>
DNS fetch: {{noDnsFailedRealFetch}}<br>
SSL pollyfill: {{SSLFailed}}<br>
SSL fetch: {{SSLFailedRealFetch}}
<br>
<br>
{
"version": "0.12.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-fetch": "2.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment