Skip to content

Instantly share code, notes, and snippets.

Alex Matchneer machty

Block or report user

Report or block machty

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@machty
machty / ember-cli-build.js
Last active Jul 15, 2019
Broccoli challenges
View ember-cli-build.js
/* jshint node: true */
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const generateWhitelabelIndexes = require('./generate-whitelabel-indexes');
module.exports = function(defaults) {
const app = new EmberApp(defaults, {
// ...all sorts of config
});
View controllers.application.js
import Ember from 'ember';
import { task, timeout, waitForProperty } from 'ember-concurrency';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
count: 0,
foo: task(function() {
return {
@machty
machty / document-title-router.js
Created Jan 14, 2014
document.title integration in ember
View document-title-router.js
// Extend Ember.Route to add support for sensible
// document.title integration.
Ember.Route.reopen({
// `titleToken` can either be a static string or a function
// that accepts a model object and returns a string (or array
// of strings if there are multiple tokens).
titleToken: null,
View controllers.application.js
import Ember from 'ember';
import { task, timeout, waitForProperty } from 'ember-concurrency';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
lol: false,
foo: task(function * () {
this.set('lol', false);
@machty
machty / e-c-observable-integration.md
Created Nov 26, 2016
ember-concurrency observable integration thoughts
View e-c-observable-integration.md

Observable integration

Lots of FPR libraries use Observables as their central async/concurrency primitive, so it'd be nice if ember-concurrency could integrate with these libraries.

Before delving into how this might be possible, here's a quick compare/contrast between e-c Tasks and Observables:

  • Modeling Streams
    • both e-c tasks and observables can async streams of zero or more values followed by an optional success/error termination
      • observables emit values using onNext(), onCompleted(), and onError()
      • tasks emit values using emit(), and returning a value from a generator fn is an implicit emit(), and throwing an error is an implicit onError
View controllers.application.js
import Ember from 'ember';
let guid = () => (Math.random().toString(36) + '00000000000000000').slice(2, 14)
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
vol: Ember.computed(function() {
return guid();
}).volatile(),
actions: {
View controllers.application.js
import Ember from 'ember';
import { lifespan, subscription } from "../subscription";
import { bind } from '@ember/runloop';
import { task, timeout } from 'ember-concurrency';
export default Ember.Controller.extend({
chatRooms:[ "EmberChat", "ReactChat", "VueChat", "AngularChat"],
chatRoom: null,
// chatRoomName: null,
View controllers.application.js
import Ember from 'ember';
import { subscription } from "../subscription";
import { bind } from '@ember/runloop';
import { task, timeout } from 'ember-concurrency';
export default Ember.Controller.extend({
chatRooms:[ "EmberChat", "ReactChat", "VueChat", "AngularChat"],
chatRoomName: null,
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
You can’t perform that action at this time.