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
function makeRequest(url) { | |
fetch(url) | |
.then(response => response.json()) | |
.then(json => it.next(json)) | |
.catch(error => console.error('Somthing shit the bed', error)); | |
} | |
function *syncRequests() { | |
const redditUrl = 'https://www.reddit.com/controversial.json?count=1&limit=2'; | |
const page1 = yield makeRequest(redditUrl); |
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
var myObject = { | |
"foo": true, | |
"author": "simon", | |
"env": 123 | |
} | |
var myProxy = new JavaAdapter(org.mozilla.javascript.NativeObject, { | |
// The "start" argument is here for setters and getters living | |
// on a prototype, so they know what to use as "this"-object. | |
put: function(name, start, value) { |
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
var myObject = { | |
"foo": true, | |
"author": "simon", | |
"env": 123 | |
} | |
var myProxy = new JavaAdapter(org.mozilla.javascript.NativeObject, { | |
// The "start" argument is here for setters and getters living | |
// on a prototype, so they know what to use as "this"-object. | |
put: function(name, start, value) { |
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
/* The API controller | |
Exports 3 methods: | |
* post - Creates a new thread | |
* list - Returns a list of threads | |
* show - Displays a thread and its posts | |
*/ | |
var Thread = require('../models/thread.js'); | |
var Post = require('../models/post.js'); |