Skip to content

Instantly share code, notes, and snippets.

View state-machine.js
/*
Run against HEAD of `next`.
The console output will likely make the order of operations clear, it is designed to try and guide you through the behavior.
Two issues:
- The first invoked promise does not trigger a done event, so the timeout catches and that state node re-enters.
- The `assign` for the later state (spawn) is running before an action for the previous state (reset).
One curiousity:
View machine.js
(function (xstate, constants) {
'use strict';
/**
* Leaf state condition generator.
*
* @param {String} target the target state
*/
function matchLeafState(target) {
return {
View machine.js
var windowId = 0;
function windowManager() {
return Machine({
id: 'window-manager',
initial: 'idle',
type: 'parallel',
states: {
idle: {
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
radioValue: 'one',
display: Ember.computed('radioValue', function() {
return JSON.stringify(this.get('radioValue'));
}),
actions: {
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View router.js
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('products', function() {
View controllers.list.details.js
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['something'],
filter: null,
actions: {
reloadList() {
this.transitionToRoute('list.details', { queryParams: { filter: 'hello' } });
},
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
value: {
id: 12,
name: 'james'
}
});
View controllers.index.js
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['category', 'term'],
category: 0,
term: 0,
actions: {
increment(qp) {
let routeArgument = {};