File tree Expand file tree Collapse file tree 7 files changed +45
-33
lines changed Expand file tree Collapse file tree 7 files changed +45
-33
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,9 @@ export default class DocsHeaderSearchBox extends Component {
2121 // the project) within a new addonDocs service that wires all that up together.
2222 // I think it's fine if our Docs-* components assume there is a single global
2323 // project.
24- @task
25- * fetchProject ( ) {
26- yield this . store . findRecord ( 'project' , this . config . projectName ) ;
27- }
24+ fetchProject = task ( async ( ) => {
25+ await this . store . findRecord ( 'project' , this . config . projectName ) ;
26+ } ) ;
2827
2928 @action
3029 focusSearch ( ) {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import Component from '@glimmer/component';
33import { tracked } from '@glimmer/tracking' ;
44import { action } from '@ember/object' ;
55import { keyResponder , onKey } from 'ember-keyboard' ;
6- import { restartableTask } from 'ember-concurrency' ;
6+ import { task } from 'ember-concurrency' ;
77import { addonDocsConfig } from 'ember-cli-addon-docs/-private/config' ;
88
99@keyResponder
@@ -32,17 +32,16 @@ export default class DocsHeaderSearchResults extends Component {
3232 return this . args . query . trim ( ) ;
3333 }
3434
35- @restartableTask
36- * search ( ) {
35+ search = task ( { restartable : true } , async ( ) => {
3736 let results ;
3837
3938 if ( this . trimmedQuery ) {
40- results = yield this . docsSearch . search ( this . trimmedQuery ) ;
39+ results = await this . docsSearch . search ( this . trimmedQuery ) ;
4140 }
4241
4342 this . selectedIndex = results . length ? 0 : null ;
4443 this . rawSearchResults = results ;
45- }
44+ } ) ;
4645
4746 get searchResults ( ) {
4847 let rawSearchResults = this . rawSearchResults ;
Original file line number Diff line number Diff line change 11import Service from '@ember/service' ;
22import lunr from 'lunr' ;
3- import { enqueueTask } from 'ember-concurrency' ;
3+ import { task } from 'ember-concurrency' ;
44import {
55 getAddonDocsConfig ,
66 getRootURL ,
@@ -89,11 +89,10 @@ export default class DocsSearch extends Service {
8989 return this . _loadSearchIndex . perform ( ) ;
9090 }
9191
92- @enqueueTask
93- * _loadSearchIndex ( ) {
92+ _loadSearchIndex = task ( { enqueue : true } , async ( ) => {
9493 if ( ! this . _searchIndex ) {
95- let response = yield fetch ( this . _indexURL ) ;
96- let json = yield response . json ( ) ;
94+ let response = await fetch ( this . _indexURL ) ;
95+ let json = await response . json ( ) ;
9796
9897 this . _searchIndex = {
9998 index : Index . load ( json . index ) ,
@@ -102,7 +101,7 @@ export default class DocsSearch extends Service {
102101 }
103102
104103 return this . _searchIndex ;
105- }
104+ } ) ;
106105
107106 get _indexURL ( ) {
108107 return `${ getRootURL ( this ) } ember-cli-addon-docs/search-index.json` ;
Original file line number Diff line number Diff line change @@ -11,12 +11,11 @@ export default class ProjectVersionService extends Service {
1111
1212 @addonDocsConfig config ;
1313
14- @task
15- * _loadAvailableVersions ( ) {
16- let response = yield fetch ( `${ this . root } versions.json` ) ;
14+ _loadAvailableVersions = task ( async ( ) => {
15+ let response = await fetch ( `${ this . root } versions.json` ) ;
1716 let json ;
1817 if ( response . ok ) {
19- json = yield response . json ( ) ;
18+ json = await response . json ( ) ;
2019 } else {
2120 json = {
2221 [ this . config . latestVersionName ] : Object . assign ( { } , this . currentVersion ) ,
@@ -30,7 +29,7 @@ export default class ProjectVersionService extends Service {
3029
3130 return version ;
3231 } ) ;
33- }
32+ } ) ;
3433
3534 redirectTo ( version ) {
3635 window . location . href = `${ this . root } ${ version . path } ` ;
Original file line number Diff line number Diff line change @@ -18,6 +18,12 @@ module.exports = {
1818 LATEST_VERSION_NAME ,
1919
2020 options : {
21+ babel : {
22+ plugins : [
23+ require . resolve ( 'ember-concurrency/async-arrow-task-transform' ) ,
24+ ] ,
25+ } ,
26+
2127 postcssOptions : {
2228 compile : {
2329 extension : 'scss' ,
Original file line number Diff line number Diff line change 5757 "ember-cli-version-checker" : " ^5.1.2" ,
5858 "ember-code-snippet" : " ^3.0.0" ,
5959 "ember-composable-helpers" : " ^5.0.0" ,
60- "ember-concurrency" : " ^3 .1.1 " ,
60+ "ember-concurrency" : " ^5 .1.0 " ,
6161 "ember-keyboard" : " ^9.0.1" ,
6262 "ember-modal-dialog" : " ^4.1.4" ,
6363 "ember-router-generator" : " ^2.0.0" ,
You can’t perform that action at this time.
0 commit comments