Skip to content

Instantly share code, notes, and snippets.

View dagda1's full-sized avatar

Paul dagda1

View GitHub Profile
try {
var users = getJSON('/users');
var companies = getJSON('/companies');
var contacts = getJSON('/contacts');
return [users, companies, contacts];
} cacth (e) {
//handler error
}
BulkLoader.prototype.load = function(callback){
var self = this;
$.getJSON('/login').done(function(data) {
$.getJSON('/users').done(function(data) {
self.users = data;
$.getJSON('/companies').done(function(data) {
self.companies = data;
$.getJSON('/contacts').done(function(data) {
self.contacts = data;
try {
var users = getJSON('/users');
var companies = getJSON('/companies');
var contacts = getJSON('/contacts');
return [users, companies, contacts];
} cacth (e) {
//handler error
}
export default function async(generatorFunc) {
function continuer(verb, arg) {
var result;
try {
result = generator[verb](arg);
} catch (err) {
return RSVP.Promise.reject(err);
}
if (result.done) {
return result.value;
BulkLoader.prototype.load = function(callback){
var self = this;
$.getJSON('/login').done(function(data) {
$.getJSON('/users').done(function(data) {
self.users = data;
$.getJSON('/companies').done(function(data) {
self.companies = data;
$.getJSON('/contacts').done(function(data) {
self.contacts = data;
try {
var users = getJSON('/users');
var companies = getJSON('/companies');
var contacts = getJSON('/contacts');
return [users, companies, contacts];
} cacth (e) {
//handler error
}
BulkLoader.prototype.load = function(callback){
var self = this;
$.getJSON('/login').done(function(data) {
$.getJSON('/users').done(function(data) {
self.users = data;
$.getJSON('/companies').done(function(data) {
self.companies = data;
$.getJSON('/contacts').done(function(data) {
self.contacts = data;
BulkLoader.prototype.load = function(callback){
var self = this;
return new RSVP.Promise(function(resolve, reject) {
return getJSON('/login').then(function(token) {
return RSVP.hash({
users: getJSON('/users'),
contacts: getJSON('/contacts'),
companies: getJSON('/companies')
BulkLoader.prototype.load = function() {
var self = this;
return async(function * () {
try {
self.users = yield getJSON('/users');
self.contacts = yield getJSON('/contacts');
self.companies = yield getJSON('/companies');
return self;
@dagda1
dagda1 / one.js
Last active August 29, 2015 13:56
function * oneToThree() {
yield 1;
yield 2;
yield 3;
}
var iterator = oneToThree(),
obj = {};
while(!obj.done) {