Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,14 @@ export default class QuickstartButton extends Component {
return this.isBusy || this.args.disabled;
}

@task(function* () {
handleSubmitTask = task(async () => {
try {
const result = yield this.onClick();
const result = await this.onClick();
this.statechart.send('SUCCESS', { result });
} catch (e) {
this.statechart.send('ERROR', { error: e });
}
})
handleSubmitTask;
});

@action
handleClick() {
Expand Down
5 changes: 2 additions & 3 deletions docs/statecharts.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,9 @@ export default class MyComponent extends Component {
}
})

@task(function*() {
buttonClickedTask = task(async () => {
// ...
})
buttonClickedTask;
});

@action
buttonClicked() {
Expand Down
5 changes: 1 addition & 4 deletions packages/ember-statecharts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@
"ember-cli-sri": "^2.1.1",
"ember-cli-terser": "^4.0.2",
"ember-cli-typescript-blueprints": "^3.0.0",
"ember-concurrency": "^1.2.1",
"ember-concurrency-async": "^0.3.1",
"ember-concurrency-decorators": "^2.0.1",
"ember-concurrency-ts": "^0.2.0",
"ember-concurrency": "^2.3.2",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-export-application-global": "^2.0.1",
"ember-load-initializers": "^2.1.2",
Expand Down
7 changes: 3 additions & 4 deletions packages/site/app/components/quickstart-button-refined.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,14 @@ export default class QuickstartButtonFinal extends Component {
};
});

@task(function* () {
handleSubmitTask = task(async () => {
try {
const result = yield this.onClick();
const result = await this.onClick();
this.statechart.send('SUCCESS', { result });
} catch (e) {
this.statechart.send('ERROR', { error: e });
}
})
handleSubmitTask;
});

@action
handleClick() {
Expand Down
7 changes: 3 additions & 4 deletions packages/site/app/components/quickstart-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ export default class QuickstartButton extends Component {
return this.isBusy || this.args.disabled;
}

@task(function* () {
handleSubmitTask = task(async () => {
try {
const result = yield this.onClick();
const result = await this.onClick();
this.statechart.send('SUCCESS', { result });
} catch (e) {
this.statechart.send('ERROR', { error: e });
}
})
handleSubmitTask;
});

@action
handleClick() {
Expand Down
12 changes: 5 additions & 7 deletions packages/site/app/components/typed-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ import buttonMachine, {
ButtonEvent,
ButtonState,
} from '../machines/typed-button';
import { TaskGenerator } from 'ember-concurrency';

import { task } from 'ember-concurrency-decorators';
import { taskFor } from 'ember-concurrency-ts';
import { task } from 'ember-concurrency';

import { action } from '@ember/object';

Expand Down Expand Up @@ -72,15 +70,15 @@ export default class TypedButton extends Component<ButtonArgs> {
}
);

@task *submitTask(): TaskGenerator<void> {
submitTask = task(this, async () => {
try {
const result = yield this.onClick();
const result = await this.onClick();

this.statechart.send('SUCCESS', { result });
} catch (e) {
this.statechart.send('ERROR', { error: e });
}
}
});

@action
handleClick(): void {
Expand Down Expand Up @@ -109,7 +107,7 @@ export default class TypedButton extends Component<ButtonArgs> {

@action
performSubmitTask(): void {
taskFor(this.submitTask).perform();
this.submitTask.perform();
}
}
// END-SNIPPET
5 changes: 1 addition & 4 deletions packages/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@
"ember-cli-sri": "^2.1.1",
"ember-cli-terser": "^4.0.1",
"ember-cli-typescript-blueprints": "^3.0.0",
"ember-concurrency": "^1.2.1",
"ember-concurrency-async": "^0.3.1",
"ember-concurrency-decorators": "^2.0.1",
"ember-concurrency-ts": "^0.2.0",
"ember-concurrency": "^2.3.2",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-export-application-global": "^2.0.1",
"ember-load-initializers": "^2.1.2",
Expand Down
2 changes: 0 additions & 2 deletions types/dummy/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
import 'ember-concurrency-async';
import 'ember-concurrency-ts/async';
61 changes: 15 additions & 46 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250"
integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==

"@babel/helper-plugin-utils@^7.10.1", "@babel/helper-plugin-utils@^7.10.4":
"@babel/helper-plugin-utils@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375"
integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==
Expand Down Expand Up @@ -3141,7 +3141,7 @@
lodash "^4.17.11"
to-fast-properties "^2.0.0"

"@babel/types@^7.10.2", "@babel/types@^7.10.4", "@babel/types@^7.10.5", "@babel/types@^7.11.0", "@babel/types@^7.11.5":
"@babel/types@^7.10.4", "@babel/types@^7.10.5", "@babel/types@^7.11.0", "@babel/types@^7.11.5":
version "7.11.5"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.11.5.tgz#d9de577d01252d77c6800cee039ee64faf75662d"
integrity sha512-bvM7Qz6eKnJVFIn+1LPtjlBFPVN5jNDc1XmN15vWe7Q3DPBufWWsLiIvUu7xW87uTG6QoggpIDnUgLQvPheU+Q==
Expand Down Expand Up @@ -3391,13 +3391,6 @@
ember-cli-path-utils "^1.0.0"
ember-cli-typescript "^4.1.0"

"@ember-decorators/utils@^6.1.0":
version "6.1.1"
resolved "https://registry.yarnpkg.com/@ember-decorators/utils/-/utils-6.1.1.tgz#6b619814942b4fb3747cfa9f540c9f05283d7c5e"
integrity sha512-0KqnoeoLKb6AyoSU65TRF5T85wmS4uDn06oARddwNPxxf/lt5jQlh41uX3W7V/fWL9tPu8x1L1Vvpc80MN1+YA==
dependencies:
ember-cli-babel "^7.1.3"

"@ember-template-lint/todo-utils@^10.0.0":
version "10.0.0"
resolved "https://registry.yarnpkg.com/@ember-template-lint/todo-utils/-/todo-utils-10.0.0.tgz#085aafcf31ca04ba4d3a9460f088aed752b90ea8"
Expand Down Expand Up @@ -10476,7 +10469,7 @@ ember-cli-babel@^6.0.0-beta.4, ember-cli-babel@^6.11.0, ember-cli-babel@^6.17.0,
ember-cli-version-checker "^2.1.2"
semver "^5.5.0"

ember-cli-babel@^7.0.0, ember-cli-babel@^7.1.0, ember-cli-babel@^7.1.3, ember-cli-babel@^7.10.0, ember-cli-babel@^7.13.0, ember-cli-babel@^7.13.2, ember-cli-babel@^7.19.0, ember-cli-babel@^7.21.0, ember-cli-babel@^7.22.1, ember-cli-babel@^7.23.0, ember-cli-babel@^7.23.1, ember-cli-babel@^7.26.5, ember-cli-babel@^7.26.6, ember-cli-babel@^7.7.3:
ember-cli-babel@^7.0.0, ember-cli-babel@^7.1.0, ember-cli-babel@^7.10.0, ember-cli-babel@^7.13.0, ember-cli-babel@^7.13.2, ember-cli-babel@^7.19.0, ember-cli-babel@^7.21.0, ember-cli-babel@^7.22.1, ember-cli-babel@^7.23.0, ember-cli-babel@^7.23.1, ember-cli-babel@^7.26.5, ember-cli-babel@^7.26.6, ember-cli-babel@^7.7.3:
version "7.26.6"
resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-7.26.6.tgz#322fbbd3baad9dd99e3276ff05bc6faef5e54b39"
integrity sha512-040svtfj2RC35j/WMwdWJFusZaXmNoytLAMyBDGLMSlRvznudTxZjGlPV6UupmtTBApy58cEF8Fq4a+COWoEmQ==
Expand Down Expand Up @@ -10509,7 +10502,7 @@ ember-cli-babel@^7.0.0, ember-cli-babel@^7.1.0, ember-cli-babel@^7.1.3, ember-cl
rimraf "^3.0.1"
semver "^5.5.0"

ember-cli-babel@^7.17.2:
ember-cli-babel@^7.17.2, ember-cli-babel@^7.26.11:
version "7.26.11"
resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-7.26.11.tgz#50da0fe4dcd99aada499843940fec75076249a9f"
integrity sha512-JJYeYjiz/JTn34q7F5DSOjkkZqy8qwFOOxXfE6pe9yEJqWGu4qErKxlz8I22JoVEQ/aBUO+OcKTpmctvykM9YA==
Expand Down Expand Up @@ -11214,43 +11207,19 @@ ember-compatibility-helpers@^1.2.1:
ember-cli-version-checker "^5.1.1"
semver "^5.4.1"

ember-concurrency-async@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/ember-concurrency-async/-/ember-concurrency-async-0.3.1.tgz#69e7c17f49f00521e01274fa1c5a57d56671ad11"
integrity sha512-8JtedudLj9pmPX64clNW+b1hwDRewbmTvQroOEnv7dpc77jExnO+YD77PH0H7uWG8FtU5o0FdIFKxT1CrEFu+g==
dependencies:
"@babel/helper-plugin-utils" "^7.10.1"
"@babel/types" "^7.10.2"
ember-cli-babel "^7.19.0"
ember-cli-babel-plugin-helpers "^1.1.0"
ember-cli-htmlbars "^4.3.1"

ember-concurrency-decorators@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/ember-concurrency-decorators/-/ember-concurrency-decorators-2.0.1.tgz#f5465785e6cf44684fb158ae6ab3aa1b131fae43"
integrity sha512-KJ8mCZxmvgalawh/zytURsc5ParNr9avPeCDR/mE7VQxWvITHtyAuYS2s1PPFQAQggTXTZYcGnfgzjn/cDHNMQ==
dependencies:
"@ember-decorators/utils" "^6.1.0"
ember-cli-babel "^7.19.0"
ember-cli-htmlbars "^4.3.1"
ember-cli-typescript "^3.1.4"

ember-concurrency-ts@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/ember-concurrency-ts/-/ember-concurrency-ts-0.2.0.tgz#0daa8d4334ec6dd78345d940615be9e45826b35a"
integrity sha512-cvdzoSzWWdtdGHOy4qisU0FI9F6Kz0/ZKXXszjW2fIE/dxeVuSKvnIppMnZO6K48L22v/Nq99Hj0OY4yCnz34A==
dependencies:
ember-cli-babel "^7.19.0"
ember-cli-htmlbars "^4.3.1"

ember-concurrency@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/ember-concurrency/-/ember-concurrency-1.2.1.tgz#54fb234579638c5c43d4153a4e14567fe2b2e325"
integrity sha512-6zlK3BndPPZlSVWq6xBohwobpDKrI58nMMDfD8OqjoeBwnaznuyVHJqDZ46NRJrvSqYX6R96XBBVpDGCCcbK+w==
ember-concurrency@^2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/ember-concurrency/-/ember-concurrency-2.3.2.tgz#7a5623c0ca04b1ef189bcca899b0d3a813e0b728"
integrity sha512-ne+yvIVDjzI4EG4qlO1T/Wx07QUYyTaOAmpUGD1wy3sMnQYYbCpvwdkM3F15jY3c4zDtfB5L1IhM0kHCtabWxQ==
dependencies:
ember-cli-babel "^7.7.3"
"@babel/helper-plugin-utils" "^7.12.13"
"@babel/types" "^7.12.13"
"@glimmer/tracking" "^1.0.4"
ember-cli-babel "^7.26.11"
ember-cli-babel-plugin-helpers "^1.1.1"
ember-cli-htmlbars "^5.7.1"
ember-compatibility-helpers "^1.2.0"
ember-maybe-import-regenerator "^0.1.6"
ember-destroyable-polyfill "^2.0.2"

ember-data@~3.28.0:
version "3.28.4"
Expand Down