ember-source 4.0.0-beta.6 → 4.1.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +420 -78
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +4 -1
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +122 -40
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/header/loader.js +1 -0
- package/dist/packages/@ember/-internals/glimmer/index.js +5 -5
- package/dist/packages/@ember/-internals/metal/index.js +65 -2
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +8 -8
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +1 -1
- package/dist/packages/@ember/application/lib/application.js +1 -1
- package/dist/packages/@ember/canary-features/index.js +6 -4
- package/dist/packages/@ember/service/index.js +19 -5
- package/dist/packages/@glimmer/tracking/index.js +1 -1
- package/dist/packages/ember/index.js +2 -2
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/lib/adapters/qunit.js +1 -0
- package/docs/data.json +69 -21
- package/lib/index.js +11 -48
- package/package.json +28 -29
- package/dist/packages/jquery/index.js +0 -2
package/docs/data.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "The Ember API",
|
|
4
4
|
"description": "The Ember API: a framework for building ambitious web applications",
|
|
5
5
|
"url": "https://emberjs.com/",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.1.0-alpha.5"
|
|
7
7
|
},
|
|
8
8
|
"files": {
|
|
9
9
|
"node_modules/rsvp/lib/rsvp/promise/all.js": {
|
|
@@ -601,6 +601,13 @@
|
|
|
601
601
|
},
|
|
602
602
|
"namespaces": {}
|
|
603
603
|
},
|
|
604
|
+
"packages/@ember/-internals/metal/lib/cached.ts": {
|
|
605
|
+
"name": "packages/@ember/-internals/metal/lib/cached.ts",
|
|
606
|
+
"modules": {},
|
|
607
|
+
"classes": {},
|
|
608
|
+
"fors": {},
|
|
609
|
+
"namespaces": {}
|
|
610
|
+
},
|
|
604
611
|
"packages/@ember/-internals/metal/lib/computed.ts": {
|
|
605
612
|
"name": "packages/@ember/-internals/metal/lib/computed.ts",
|
|
606
613
|
"modules": {},
|
|
@@ -1915,7 +1922,7 @@
|
|
|
1915
1922
|
"tag": "module",
|
|
1916
1923
|
"file": "packages/@ember/-internals/glimmer/lib/glimmer-component-docs.ts",
|
|
1917
1924
|
"line": 1,
|
|
1918
|
-
"description": "A component is a reusable UI element that consists of a `.hbs` template and an\noptional JavaScript class that defines its behavior. For example, someone\nmight make a `button` in the template and handle the click behavior in the\nJavaScript file that shares the same name as the template.\n\nComponents are broken down into two categories:\n\n- Components _without_ JavaScript, that are based only on a template. These\n are called Template-only or TO components.\n- Components _with_ JavaScript, which consist of a template and a backing\n class.\n\nEmber ships with two types of JavaScript classes for components:\n\n1. Glimmer components, imported from `@glimmer/component`, which are the\n default component's for Ember Octane (3.15) and more recent editions.\n2. Classic components, imported from `@ember/component`, which were the\n default for older editions of Ember (pre 3.15).\n\nBelow is the documentation for Template-only and Glimmer components. If you\nare looking for the API documentation for Classic components, it is\n[available here](/ember/release/classes/Component). The source code for\nGlimmer components can be found in [`@glimmer/component`](https://github.com/glimmerjs/glimmer.js/tree/master/packages/%40glimmer/component).\n\n## Defining a Template-only Component\n\nThe simplest way to create a component is to create a template file in\n`app/templates/components`. For example, if you name a template\n`app/templates/components/person-profile.hbs`:\n\n```app/templates/components/person-profile.hbs\n<h1>{{@person.name}}</h1>\n<img src={{@person.avatar}}>\n<p class='signature'>{{@person.signature}}</p>\n```\n\nYou will be able to use `<PersonProfile />` to invoke this component elsewhere\nin your application:\n\n```app/templates/application.hbs\n<PersonProfile @person={{this.currentUser}} />\n```\n\nNote that component names are capitalized here in order to distinguish them\nfrom regular HTML elements, but they are dasherized in the file system.\n\nWhile the angle bracket invocation form is generally preferred, it is also\npossible to invoke the same component with the `{{person-profile}}` syntax:\n\n```app/templates/application.hbs\n{{person-profile person=this.currentUser}}\n```\n\nNote that with this syntax, you use dashes in the component name and\narguments are passed without the `@` sign.\n\nIn both cases, Ember will render the content of the component template we\ncreated above. The end result will be something like this:\n\n```html\n<h1>Tomster</h1>\n<img src=\"https://emberjs.com/tomster.jpg\">\n<p class='signature'>Out of office this week</p>\n```\n\n## File System Nesting\n\nComponents can be nested inside sub-folders for logical groupping. For\nexample, if we placed our template in\n`app/templates/components/person/short-profile.hbs`, we can invoke it as\n`<Person::ShortProfile />`:\n\n```app/templates/application.hbs\n<Person::ShortProfile @person={{this.currentUser}} />\n```\n\nOr equivalently, `{{person/short-profile}}`:\n\n```app/templates/application.hbs\n{{person/short-profile person=this.currentUser}}\n```\n\n## Using Blocks\n\nYou can use `yield` inside a template to include the **contents** of any block\nattached to the component. For instance, if we added a `{{yield}}` to our\ncomponent like so:\n\n```app/templates/components/person-profile.hbs\n<h1>{{@person.name}}</h1>\n{{yield}}\n```\n\nWe could then invoke it like this:\n\n```handlebars\n<PersonProfile @person={{this.currentUser}}>\n <p>Admin mode</p>\n</PersonProfile>\n```\n\nor with curly syntax like this:\n\n```handlebars\n{{#person-profile person=this.currentUser}}\n <p>Admin mode</p>\n{{/person-profile}}\n```\n\nAnd the content passed in between the brackets of the component would be\nrendered in the same place as the `{{yield}}` within it, replacing it.\n\nBlocks are executed in their original context, meaning they have access to the\nscope and any in-scope variables where they were defined.\n\n### Passing parameters to blocks\n\nYou can also pass positional parameters to `{{yield}}`, which are then made\navailable in the block:\n\n```app/templates/components/person-profile.hbs\n<h1>{{@person.name}}</h1>\n{{yield @person.signature}}\n```\n\nWe can then use this value in the block like so:\n\n```handlebars\n<PersonProfile @person={{this.currentUser}} as |signature|>\n {{signature}}\n</PersonProfile>\n```\n\n### Passing multiple blocks\n\nYou can pass multiple blocks to a component by giving them names, and\nspecifying which block you are yielding to with `{{yield}}`. For instance, if\nwe wanted to add a way for users to customize the title of our\n`<PersonProfile>` component, we could add a named block inside of the header:\n\n```app/templates/components/person-profile.hbs\n<h1>{{yield to=\"title\"}}</h1>\n{{yield}}\n```\n\nThis component could then be invoked like so:\n\n```handlebars\n<PersonProfile @person={{this.currentUser}}>\n <:title>{{this.currentUser.name}}</:title>\n <:default>{{this.currentUser.signature}}</:default>\n</PersonProfile>\n```\n\nWhen passing named blocks, you must name every block, including the `default`\nblock, which is the block that is defined if you do not pass a `to` parameter\nto `{{yield}}`. Whenever you invoke a component without passing explicitly\nnamed blocks, the passed block is considered the `default` block.\n\n### Passing parameters to named blocks\n\nYou can also pass parameters to named blocks:\n\n```app/templates/components/person-profile.hbs\n<h1>{{yield @person.name to=\"title\"}}</h1>\n{{yield @person.signature}}\n```\n\nThese parameters can then be used like so:\n\n```handlebars\n<PersonProfile @person={{this.currentUser}}>\n <:title as |name|>{{name}}</:title>\n <:default as |signature|>{{signature}}</:default>\n</PersonProfile>\n```\n\n### Checking to see if a block exists\n\nYou can also check to see if a block exists using the `(has-block)` keyword,\nand conditionally use it, or provide a default template instead.\n\n```app/templates/components/person-profile.hbs\n<h1>\n {{#if (has-block \"title\")}}\n {{yield @person.name to=\"title\"}}\n {{else}}\n {{@person.name}}\n {{/if}}\n</h1>\n\n{{#if (has-block)}}\n {{yield @person.signature}}\n{{else}}\n {{@person.signature}}\n{{/if}}\n```\n\nWith this template, we can then optionally pass in one block, both blocks, or\nnone at all:\n\n```handlebars\n{{! passing both blocks }}\n<PersonProfile @person={{this.currentUser}}>\n <:title as |name|>{{name}}</:title>\n <:default as |signature|>{{signature}}</:default>\n</PersonProfile>\n\n{{! passing just the title block }}\n<PersonProfile @person={{this.currentUser}}>\n <:title as |name|>{{name}}</:title>\n</PersonProfile>\n\n{{! passing just the default block }}\n<PersonProfile @person={{this.currentUser}} as |signature|>\n {{signature}}\n</PersonProfile>\n\n{{! not passing any blocks }}\n<PersonProfile @person={{this.currentUser}}/>\n```\n\n### Checking to see if a block has parameters\n\nWe can also check if a block receives parameters using the `(has-block-params)`\nkeyword, and conditionally yield different values if so.\n\n```app/templates/components/person-profile.hbs\n{{#if (has-block-params)}}\n {{yield @person.signature}}\n{{else}}\n {{yield}}\n{{/if}}\n```\n\n## Customizing Components With JavaScript\n\nTo add JavaScript to a component, create a JavaScript file in the same\nlocation as the template file, with the same name, and export a subclass\nof `Component` as the default value. For example, to add Javascript to the\n`PersonProfile` component which we defined above, we would create\n`app/comopnents/person-profile.js` and export our class as the default, like\nso:\n\n```app/components/person-profile.js\nimport Component from '@glimmer/component';\n\nexport default class PersonProfileComponent extends Component {\n get displayName() {\n let { title, firstName, lastName } = this.args.person;\n\n if (title) {\n return `${title} ${lastName}`;\n } else {\n return `${firstName} ${lastName}`;\n }\n })\n}\n```\n\nYou can add your own properties, methods, and lifecycle hooks to this\nsubclass to customize its behavior, and you can reference the instance of the\nclass in your template using `{{this}}`. For instance, we could access the\n`displayName` property of our `PersonProfile` component instance in the\ntemplate like this:\n\n```app/templates/components/person-profile.hbs\n<h1>{{this.displayName}}</h1>\n{{yield}}\n```\n\n## `constructor`\n\nparams: `owner` object and `args` object\n\nConstructs a new component and assigns itself the passed properties. The\nconstructor is run whenever a new instance of the component is created, and\ncan be used to setup the initial state of the component.\n\n```javascript\nimport Component from '@glimmer/component';\n\nexport default class SomeComponent extends Component {\n constructor(owner, args) {\n super(owner, args);\n\n if (this.args.displayMode === 'list') {\n this.items = [];\n }\n }\n}\n```\n\nService injections and arguments are available in the constructor.\n\n```javascript\nimport Component from '@glimmer/component';\nimport { inject as service } from '@ember/service';\n\nexport default class SomeComponent extends Component {\n @service myAnimations;\n\n constructor(owner, args) {\n super(owner, args);\n\n if (this.args.fadeIn === true) {\n this.myAnimations.register(this, 'fade-in');\n }\n }\n}\n```\n\n## `willDestroy`\n\n`willDestroy` is called after the component has been removed from the DOM, but\nbefore the component is fully destroyed. This lifecycle hook can be used to\ncleanup the component and any related state.\n\n```javascript\nimport Component from '@glimmer/component';\nimport { inject as service } from '@ember/service';\n\nexport default class SomeComponent extends Component {\n @service myAnimations;\n\n willDestroy() {\n super.willDestroy(...arguments);\n\n this.myAnimations.unregister(this);\n }\n}\n```\n\n## `args`\n\nThe `args` property of Glimmer components is an object that contains the\n_arguments_ that are passed to the component. For instance, the\nfollowing component usage:\n\n```handlebars\n<SomeComponent @fadeIn={{true}} />\n```\n\nWould result in the following `args` object to be passed to the component:\n\n```javascript\n{ fadeIn: true }\n```\n\n`args` can be accessed at any point in the component lifecycle, including\n`constructor` and `willDestroy`. They are also automatically marked as tracked\nproperties, and they can be depended on as computed property dependencies:\n\n```javascript\nimport Component from '@glimmer/component';\nimport { computed } from '@ember/object';\n\nexport default class SomeComponent extends Component {\n\n @computed('args.someValue')\n get computedGetter() {\n // updates whenever args.someValue updates\n return this.args.someValue;\n }\n\n get standardGetter() {\n // updates whenever args.anotherValue updates (Ember 3.13+)\n return this.args.anotherValue;\n }\n}\n```\n\n## `isDestroying`\n\nA boolean flag to tell if the component is in the process of destroying. This is set to\ntrue before `willDestroy` is called.\n\n## `isDestroyed`\nA boolean to tell if the component has been fully destroyed. This is set to true\nafter `willDestroy` is called.",
|
|
1925
|
+
"description": "A component is a reusable UI element that consists of a `.hbs` template and an\noptional JavaScript class that defines its behavior. For example, someone\nmight make a `button` in the template and handle the click behavior in the\nJavaScript file that shares the same name as the template.\n\nComponents are broken down into two categories:\n\n- Components _without_ JavaScript, that are based only on a template. These\n are called Template-only or TO components.\n- Components _with_ JavaScript, which consist of a template and a backing\n class.\n\nEmber ships with two types of JavaScript classes for components:\n\n1. Glimmer components, imported from `@glimmer/component`, which are the\n default component's for Ember Octane (3.15) and more recent editions.\n2. Classic components, imported from `@ember/component`, which were the\n default for older editions of Ember (pre 3.15).\n\nBelow is the documentation for Template-only and Glimmer components. If you\nare looking for the API documentation for Classic components, it is\n[available here](/ember/release/classes/Component). The source code for\nGlimmer components can be found in [`@glimmer/component`](https://github.com/glimmerjs/glimmer.js/tree/master/packages/%40glimmer/component).\n\n## Defining a Template-only Component\n\nThe simplest way to create a component is to create a template file in\n`app/templates/components`. For example, if you name a template\n`app/templates/components/person-profile.hbs`:\n\n```app/templates/components/person-profile.hbs\n<h1>{{@person.name}}</h1>\n<img src={{@person.avatar}}>\n<p class='signature'>{{@person.signature}}</p>\n```\n\nYou will be able to use `<PersonProfile />` to invoke this component elsewhere\nin your application:\n\n```app/templates/application.hbs\n<PersonProfile @person={{this.currentUser}} />\n```\n\nNote that component names are capitalized here in order to distinguish them\nfrom regular HTML elements, but they are dasherized in the file system.\n\nWhile the angle bracket invocation form is generally preferred, it is also\npossible to invoke the same component with the `{{person-profile}}` syntax:\n\n```app/templates/application.hbs\n{{person-profile person=this.currentUser}}\n```\n\nNote that with this syntax, you use dashes in the component name and\narguments are passed without the `@` sign.\n\nIn both cases, Ember will render the content of the component template we\ncreated above. The end result will be something like this:\n\n```html\n<h1>Tomster</h1>\n<img src=\"https://emberjs.com/tomster.jpg\">\n<p class='signature'>Out of office this week</p>\n```\n\n## File System Nesting\n\nComponents can be nested inside sub-folders for logical groupping. For\nexample, if we placed our template in\n`app/templates/components/person/short-profile.hbs`, we can invoke it as\n`<Person::ShortProfile />`:\n\n```app/templates/application.hbs\n<Person::ShortProfile @person={{this.currentUser}} />\n```\n\nOr equivalently, `{{person/short-profile}}`:\n\n```app/templates/application.hbs\n{{person/short-profile person=this.currentUser}}\n```\n\n## Using Blocks\n\nYou can use `yield` inside a template to include the **contents** of any block\nattached to the component. For instance, if we added a `{{yield}}` to our\ncomponent like so:\n\n```app/templates/components/person-profile.hbs\n<h1>{{@person.name}}</h1>\n{{yield}}\n```\n\nWe could then invoke it like this:\n\n```handlebars\n<PersonProfile @person={{this.currentUser}}>\n <p>Admin mode</p>\n</PersonProfile>\n```\n\nor with curly syntax like this:\n\n```handlebars\n{{#person-profile person=this.currentUser}}\n <p>Admin mode</p>\n{{/person-profile}}\n```\n\nAnd the content passed in between the brackets of the component would be\nrendered in the same place as the `{{yield}}` within it, replacing it.\n\nBlocks are executed in their original context, meaning they have access to the\nscope and any in-scope variables where they were defined.\n\n### Passing parameters to blocks\n\nYou can also pass positional parameters to `{{yield}}`, which are then made\navailable in the block:\n\n```app/templates/components/person-profile.hbs\n<h1>{{@person.name}}</h1>\n{{yield @person.signature}}\n```\n\nWe can then use this value in the block like so:\n\n```handlebars\n<PersonProfile @person={{this.currentUser}} as |signature|>\n {{signature}}\n</PersonProfile>\n```\n\n### Passing multiple blocks\n\nYou can pass multiple blocks to a component by giving them names, and\nspecifying which block you are yielding to with `{{yield}}`. For instance, if\nwe wanted to add a way for users to customize the title of our\n`<PersonProfile>` component, we could add a named block inside of the header:\n\n```app/templates/components/person-profile.hbs\n<h1>{{yield to=\"title\"}}</h1>\n{{yield}}\n```\n\nThis component could then be invoked like so:\n\n```handlebars\n<PersonProfile @person={{this.currentUser}}>\n <:title>{{this.currentUser.name}}</:title>\n <:default>{{this.currentUser.signature}}</:default>\n</PersonProfile>\n```\n\nWhen passing named blocks, you must name every block, including the `default`\nblock, which is the block that is defined if you do not pass a `to` parameter\nto `{{yield}}`. Whenever you invoke a component without passing explicitly\nnamed blocks, the passed block is considered the `default` block.\n\n### Passing parameters to named blocks\n\nYou can also pass parameters to named blocks:\n\n```app/templates/components/person-profile.hbs\n<h1>{{yield @person.name to=\"title\"}}</h1>\n{{yield @person.signature}}\n```\n\nThese parameters can then be used like so:\n\n```handlebars\n<PersonProfile @person={{this.currentUser}}>\n <:title as |name|>{{name}}</:title>\n <:default as |signature|>{{signature}}</:default>\n</PersonProfile>\n```\n\n### Checking to see if a block exists\n\nYou can also check to see if a block exists using the `(has-block)` keyword,\nand conditionally use it, or provide a default template instead.\n\n```app/templates/components/person-profile.hbs\n<h1>\n {{#if (has-block \"title\")}}\n {{yield @person.name to=\"title\"}}\n {{else}}\n {{@person.name}}\n {{/if}}\n</h1>\n\n{{#if (has-block)}}\n {{yield @person.signature}}\n{{else}}\n {{@person.signature}}\n{{/if}}\n```\n\nWith this template, we can then optionally pass in one block, both blocks, or\nnone at all:\n\n```handlebars\n{{! passing both blocks }}\n<PersonProfile @person={{this.currentUser}}>\n <:title as |name|>{{name}}</:title>\n <:default as |signature|>{{signature}}</:default>\n</PersonProfile>\n\n{{! passing just the title block }}\n<PersonProfile @person={{this.currentUser}}>\n <:title as |name|>{{name}}</:title>\n</PersonProfile>\n\n{{! passing just the default block }}\n<PersonProfile @person={{this.currentUser}} as |signature|>\n {{signature}}\n</PersonProfile>\n\n{{! not passing any blocks }}\n<PersonProfile @person={{this.currentUser}}/>\n```\n\n### Checking to see if a block has parameters\n\nWe can also check if a block receives parameters using the `(has-block-params)`\nkeyword, and conditionally yield different values if so.\n\n```app/templates/components/person-profile.hbs\n{{#if (has-block-params)}}\n {{yield @person.signature}}\n{{else}}\n {{yield}}\n{{/if}}\n```\n\n## Customizing Components With JavaScript\n\nTo add JavaScript to a component, create a JavaScript file in the same\nlocation as the template file, with the same name, and export a subclass\nof `Component` as the default value. For example, to add Javascript to the\n`PersonProfile` component which we defined above, we would create\n`app/comopnents/person-profile.js` and export our class as the default, like\nso:\n\n```app/components/person-profile.js\nimport Component from '@glimmer/component';\n\nexport default class PersonProfileComponent extends Component {\n get displayName() {\n let { title, firstName, lastName } = this.args.person;\n\n if (title) {\n return `${title} ${lastName}`;\n } else {\n return `${firstName} ${lastName}`;\n }\n })\n}\n```\n\nYou can add your own properties, methods, and lifecycle hooks to this\nsubclass to customize its behavior, and you can reference the instance of the\nclass in your template using `{{this}}`. For instance, we could access the\n`displayName` property of our `PersonProfile` component instance in the\ntemplate like this:\n\n```app/templates/components/person-profile.hbs\n<h1>{{this.displayName}}</h1>\n{{yield}}\n```\n\n## `constructor`\n\nparams: `owner` object and `args` object\n\nConstructs a new component and assigns itself the passed properties. The\nconstructor is run whenever a new instance of the component is created, and\ncan be used to setup the initial state of the component.\n\n```javascript\nimport Component from '@glimmer/component';\n\nexport default class SomeComponent extends Component {\n constructor(owner, args) {\n super(owner, args);\n\n if (this.args.displayMode === 'list') {\n this.items = [];\n }\n }\n}\n```\n\nService injections and arguments are available in the constructor.\n\n```javascript\nimport Component from '@glimmer/component';\nimport { service } from '@ember/service';\n\nexport default class SomeComponent extends Component {\n @service myAnimations;\n\n constructor(owner, args) {\n super(owner, args);\n\n if (this.args.fadeIn === true) {\n this.myAnimations.register(this, 'fade-in');\n }\n }\n}\n```\n\n## `willDestroy`\n\n`willDestroy` is called after the component has been removed from the DOM, but\nbefore the component is fully destroyed. This lifecycle hook can be used to\ncleanup the component and any related state.\n\n```javascript\nimport Component from '@glimmer/component';\nimport { service } from '@ember/service';\n\nexport default class SomeComponent extends Component {\n @service myAnimations;\n\n willDestroy() {\n super.willDestroy(...arguments);\n\n this.myAnimations.unregister(this);\n }\n}\n```\n\n## `args`\n\nThe `args` property of Glimmer components is an object that contains the\n_arguments_ that are passed to the component. For instance, the\nfollowing component usage:\n\n```handlebars\n<SomeComponent @fadeIn={{true}} />\n```\n\nWould result in the following `args` object to be passed to the component:\n\n```javascript\n{ fadeIn: true }\n```\n\n`args` can be accessed at any point in the component lifecycle, including\n`constructor` and `willDestroy`. They are also automatically marked as tracked\nproperties, and they can be depended on as computed property dependencies:\n\n```javascript\nimport Component from '@glimmer/component';\nimport { computed } from '@ember/object';\n\nexport default class SomeComponent extends Component {\n\n @computed('args.someValue')\n get computedGetter() {\n // updates whenever args.someValue updates\n return this.args.someValue;\n }\n\n get standardGetter() {\n // updates whenever args.anotherValue updates (Ember 3.13+)\n return this.args.anotherValue;\n }\n}\n```\n\n## `isDestroying`\n\nA boolean flag to tell if the component is in the process of destroying. This is set to\ntrue before `willDestroy` is called.\n\n## `isDestroyed`\nA boolean to tell if the component has been fully destroyed. This is set to true\nafter `willDestroy` is called.",
|
|
1919
1926
|
"access": "public",
|
|
1920
1927
|
"tagname": ""
|
|
1921
1928
|
},
|
|
@@ -2077,7 +2084,7 @@
|
|
|
2077
2084
|
"namespaces": {},
|
|
2078
2085
|
"tag": "module",
|
|
2079
2086
|
"file": "packages/@ember/canary-features/index.ts",
|
|
2080
|
-
"line":
|
|
2087
|
+
"line": 27,
|
|
2081
2088
|
"description": "Set `EmberENV.FEATURES` in your application's `config/environment.js` file\nto enable canary features in your application.\n\nSee the [feature flag guide](https://guides.emberjs.com/release/configuring-ember/feature-flags/)\nfor more details.",
|
|
2082
2089
|
"access": "public",
|
|
2083
2090
|
"tagname": ""
|
|
@@ -2242,7 +2249,7 @@
|
|
|
2242
2249
|
"namespaces": {},
|
|
2243
2250
|
"tag": "module",
|
|
2244
2251
|
"file": "packages/@ember/service/index.js",
|
|
2245
|
-
"line":
|
|
2252
|
+
"line": 74,
|
|
2246
2253
|
"access": "public",
|
|
2247
2254
|
"tagname": ""
|
|
2248
2255
|
},
|
|
@@ -2948,7 +2955,7 @@
|
|
|
2948
2955
|
"namespace": "",
|
|
2949
2956
|
"file": "packages/@ember/-internals/routing/lib/services/router.ts",
|
|
2950
2957
|
"line": 23,
|
|
2951
|
-
"description": "The Router service is the public API that provides access to the router.\n\nThe immediate benefit of the Router service is that you can inject it into components,\ngiving them a friendly way to initiate transitions and ask questions about the current\nglobal router state.\n\nIn this example, the Router service is injected into a component to initiate a transition\nto a dedicated route:\n\n```app/components/example.js\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport {
|
|
2958
|
+
"description": "The Router service is the public API that provides access to the router.\n\nThe immediate benefit of the Router service is that you can inject it into components,\ngiving them a friendly way to initiate transitions and ask questions about the current\nglobal router state.\n\nIn this example, the Router service is injected into a component to initiate a transition\nto a dedicated route:\n\n```app/components/example.js\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { service } from '@ember/service';\n\nexport default class ExampleComponent extends Component {\n @service router;\n\n @action\n next() {\n this.router.transitionTo('other.route');\n }\n}\n```\n\nLike any service, it can also be injected into helpers, routes, etc.",
|
|
2952
2959
|
"access": "public",
|
|
2953
2960
|
"tagname": "",
|
|
2954
2961
|
"extends": "Service"
|
|
@@ -3637,7 +3644,7 @@
|
|
|
3637
3644
|
"module": "@ember/canary-features",
|
|
3638
3645
|
"namespace": "",
|
|
3639
3646
|
"file": "packages/@ember/canary-features/index.ts",
|
|
3640
|
-
"line":
|
|
3647
|
+
"line": 27,
|
|
3641
3648
|
"description": "The hash of enabled Canary features. Add to this, any canary features\nbefore creating your application.",
|
|
3642
3649
|
"static": 1,
|
|
3643
3650
|
"since": "1.1.0",
|
|
@@ -3860,7 +3867,7 @@
|
|
|
3860
3867
|
"module": "@ember/service",
|
|
3861
3868
|
"namespace": "",
|
|
3862
3869
|
"file": "packages/@ember/service/index.js",
|
|
3863
|
-
"line":
|
|
3870
|
+
"line": 74,
|
|
3864
3871
|
"extends": "EmberObject",
|
|
3865
3872
|
"since": "1.10.0",
|
|
3866
3873
|
"access": "public",
|
|
@@ -6293,7 +6300,7 @@
|
|
|
6293
6300
|
{
|
|
6294
6301
|
"file": "packages/@ember/-internals/glimmer/lib/helpers/action.ts",
|
|
6295
6302
|
"line": 22,
|
|
6296
|
-
"description": "The `{{action}}` helper provides a way to pass triggers for behavior (usually\njust a function) between components, and into components from controllers.\n\n### Passing functions with the action helper\n\nThere are three contexts an action helper can be used in. The first two\ncontexts to discuss are attribute context, and Handlebars value context.\n\n```handlebars\n{{! An example of attribute context }}\n<div onclick={{action \"save\"}}></div>\n{{! Examples of Handlebars value context }}\n{{input on-input=(action \"save\")}}\n{{yield (action \"refreshData\") andAnotherParam}}\n```\n\nIn these contexts,\nthe helper is called a \"closure action\" helper. Its behavior is simple:\nIf passed a function name, read that function off the `actions` property\nof the current context. Once that function is read, or immediately if a function was\npassed, create a closure over that function and any arguments.\nThe resulting value of an action helper used this way is simply a function.\n\nFor example, in the attribute context:\n\n```handlebars\n{{! An example of attribute context }}\n<div onclick={{action \"save\"}}></div>\n```\n\nThe resulting template render logic would be:\n\n```js\nvar div = document.createElement('div');\nvar actionFunction = (function(context){\n return function() {\n return context.actions.save.apply(context, arguments);\n };\n})(context);\ndiv.onclick = actionFunction;\n```\n\nThus when the div is clicked, the action on that context is called.\nBecause the `actionFunction` is just a function, closure actions can be\npassed between components and still execute in the correct context.\n\nHere is an example action handler on a component:\n\n```app/components/my-component.js\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\n\nexport default class extends Component {\n @action\n save() {\n this.model.save();\n }\n}\n```\n\nActions are always looked up on the `actions` property of the current context.\nThis avoids collisions in the naming of common actions, such as `destroy`.\nTwo options can be passed to the `action` helper when it is used in this way.\n\n* `target=someProperty` will look to `someProperty` instead of the current\n context for the `actions` hash. This can be useful when targeting a\n service for actions.\n* `value=\"target.value\"` will read the path `target.value` off the first\n argument to the action when it is called and rewrite the first argument\n to be that value. This is useful when attaching actions to event listeners.\n\n### Invoking an action\n\nClosure actions curry both their scope and any arguments. When invoked, any\nadditional arguments are added to the already curried list.\nActions are presented in JavaScript as callbacks, and are\ninvoked like any other JavaScript function.\n\nFor example\n\n```app/components/update-name.js\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\n\nexport default class extends Component {\n @action\n setName(model, name) {\n model.set('name', name);\n }\n}\n```\n\n```app/components/update-name.hbs\n{{input on-input=(action (action 'setName' @model) value=\"target.value\")}}\n```\n\nThe first argument (`@model`) was curried over, and the run-time argument (`event`)\nbecomes a second argument. Action calls can be nested this way because each simply\nreturns a function. Any function can be passed to the `{{action}}` helper, including\nother actions.\n\nActions invoked with `sendAction` have the same currying behavior as demonstrated\nwith `on-input` above. For example:\n\n```app/components/my-input.js\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\n\nexport default class extends Component {\n @action\n setName(model, name) {\n model.set('name', name);\n }\n}\n```\n\n```handlebars\n<MyInput @submit={{action 'setName' @model}} />\n```\n\nor\n\n```handlebars\n{{my-input submit=(action 'setName' @model)}}\n```\n\n```app/components/my-component.js\nimport Component from '@ember/component';\n\nexport default Component.extend({\n click() {\n // Note that model is not passed, it was curried in the template\n this.submit('bob');\n }\n});\n```\n\n### Attaching actions to DOM elements\n\nThe third context of the `{{action}}` helper can be called \"element space\".\nFor example:\n\n```handlebars\n{{! An example of element space }}\n<div {{action \"save\"}}></div>\n```\n\nUsed this way, the `{{action}}` helper provides a useful shortcut for\nregistering an HTML element in a template for a single DOM event and\nforwarding that interaction to the template's context (controller or component).\nIf the context of a template is a controller, actions used this way will\nbubble to routes when the controller does not implement the specified action.\nOnce an action hits a route, it will bubble through the route hierarchy.\n\n### Event Propagation\n\n`{{action}}` helpers called in element space can control event bubbling. Note\nthat the closure style actions cannot.\n\nEvents triggered through the action helper will automatically have\n`.preventDefault()` called on them. You do not need to do so in your event\nhandlers. If you need to allow event propagation (to handle file inputs for\nexample) you can supply the `preventDefault=false` option to the `{{action}}` helper:\n\n```handlebars\n<div {{action \"sayHello\" preventDefault=false}}>\n <input type=\"file\" />\n <input type=\"checkbox\" />\n</div>\n```\n\nTo disable bubbling, pass `bubbles=false` to the helper:\n\n```handlebars\n<button {{action 'edit' post bubbles=false}}>Edit</button>\n```\n\nTo disable bubbling with closure style actions you must create your own\nwrapper helper that makes use of `event.stopPropagation()`:\n\n```handlebars\n<div onclick={{disable-bubbling (action \"sayHello\")}}>Hello</div>\n```\n\n```app/helpers/disable-bubbling.js\nimport { helper } from '@ember/component/helper';\n\nexport function disableBubbling([action]) {\n return function(event) {\n event.stopPropagation();\n return action(event);\n };\n}\nexport default helper(disableBubbling);\n```\n\nIf you need the default handler to trigger you should either register your\nown event handler, or use event methods on your view class. See\n[\"Responding to Browser Events\"](/ember/release/classes/Component)\nin the documentation for `Component` for more information.\n\n### Specifying DOM event type\n\n`{{action}}` helpers called in element space can specify an event type.\nBy default the `{{action}}` helper registers for DOM `click` events. You can\nsupply an `on` option to the helper to specify a different DOM event name:\n\n```handlebars\n<div {{action \"anActionName\" on=\"doubleClick\"}}>\n click me\n</div>\n```\n\nSee [\"Event Names\"](/ember/release/classes/Component) for a list of\nacceptable DOM event names.\n\n### Specifying whitelisted modifier keys\n\n`{{action}}` helpers called in element space can specify modifier keys.\nBy default the `{{action}}` helper will ignore click events with pressed modifier\nkeys. You can supply an `allowedKeys` option to specify which keys should not be ignored.\n\n```handlebars\n<div {{action \"anActionName\" allowedKeys=\"alt\"}}>\n click me\n</div>\n```\n\nThis way the action will fire when clicking with the alt key pressed down.\nAlternatively, supply \"any\" to the `allowedKeys` option to accept any combination of modifier keys.\n\n```handlebars\n<div {{action \"anActionName\" allowedKeys=\"any\"}}>\n click me with any key pressed\n</div>\n```\n\n### Specifying a Target\n\nA `target` option can be provided to the helper to change\nwhich object will receive the method call. This option must be a path\nto an object, accessible in the current context:\n\n```app/templates/application.hbs\n<div {{action \"anActionName\" target=someService}}>\n click me\n</div>\n```\n\n```app/controllers/application.js\nimport Controller from '@ember/controller';\nimport {
|
|
6303
|
+
"description": "The `{{action}}` helper provides a way to pass triggers for behavior (usually\njust a function) between components, and into components from controllers.\n\n### Passing functions with the action helper\n\nThere are three contexts an action helper can be used in. The first two\ncontexts to discuss are attribute context, and Handlebars value context.\n\n```handlebars\n{{! An example of attribute context }}\n<div onclick={{action \"save\"}}></div>\n{{! Examples of Handlebars value context }}\n{{input on-input=(action \"save\")}}\n{{yield (action \"refreshData\") andAnotherParam}}\n```\n\nIn these contexts,\nthe helper is called a \"closure action\" helper. Its behavior is simple:\nIf passed a function name, read that function off the `actions` property\nof the current context. Once that function is read, or immediately if a function was\npassed, create a closure over that function and any arguments.\nThe resulting value of an action helper used this way is simply a function.\n\nFor example, in the attribute context:\n\n```handlebars\n{{! An example of attribute context }}\n<div onclick={{action \"save\"}}></div>\n```\n\nThe resulting template render logic would be:\n\n```js\nvar div = document.createElement('div');\nvar actionFunction = (function(context){\n return function() {\n return context.actions.save.apply(context, arguments);\n };\n})(context);\ndiv.onclick = actionFunction;\n```\n\nThus when the div is clicked, the action on that context is called.\nBecause the `actionFunction` is just a function, closure actions can be\npassed between components and still execute in the correct context.\n\nHere is an example action handler on a component:\n\n```app/components/my-component.js\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\n\nexport default class extends Component {\n @action\n save() {\n this.model.save();\n }\n}\n```\n\nActions are always looked up on the `actions` property of the current context.\nThis avoids collisions in the naming of common actions, such as `destroy`.\nTwo options can be passed to the `action` helper when it is used in this way.\n\n* `target=someProperty` will look to `someProperty` instead of the current\n context for the `actions` hash. This can be useful when targeting a\n service for actions.\n* `value=\"target.value\"` will read the path `target.value` off the first\n argument to the action when it is called and rewrite the first argument\n to be that value. This is useful when attaching actions to event listeners.\n\n### Invoking an action\n\nClosure actions curry both their scope and any arguments. When invoked, any\nadditional arguments are added to the already curried list.\nActions are presented in JavaScript as callbacks, and are\ninvoked like any other JavaScript function.\n\nFor example\n\n```app/components/update-name.js\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\n\nexport default class extends Component {\n @action\n setName(model, name) {\n model.set('name', name);\n }\n}\n```\n\n```app/components/update-name.hbs\n{{input on-input=(action (action 'setName' @model) value=\"target.value\")}}\n```\n\nThe first argument (`@model`) was curried over, and the run-time argument (`event`)\nbecomes a second argument. Action calls can be nested this way because each simply\nreturns a function. Any function can be passed to the `{{action}}` helper, including\nother actions.\n\nActions invoked with `sendAction` have the same currying behavior as demonstrated\nwith `on-input` above. For example:\n\n```app/components/my-input.js\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\n\nexport default class extends Component {\n @action\n setName(model, name) {\n model.set('name', name);\n }\n}\n```\n\n```handlebars\n<MyInput @submit={{action 'setName' @model}} />\n```\n\nor\n\n```handlebars\n{{my-input submit=(action 'setName' @model)}}\n```\n\n```app/components/my-component.js\nimport Component from '@ember/component';\n\nexport default Component.extend({\n click() {\n // Note that model is not passed, it was curried in the template\n this.submit('bob');\n }\n});\n```\n\n### Attaching actions to DOM elements\n\nThe third context of the `{{action}}` helper can be called \"element space\".\nFor example:\n\n```handlebars\n{{! An example of element space }}\n<div {{action \"save\"}}></div>\n```\n\nUsed this way, the `{{action}}` helper provides a useful shortcut for\nregistering an HTML element in a template for a single DOM event and\nforwarding that interaction to the template's context (controller or component).\nIf the context of a template is a controller, actions used this way will\nbubble to routes when the controller does not implement the specified action.\nOnce an action hits a route, it will bubble through the route hierarchy.\n\n### Event Propagation\n\n`{{action}}` helpers called in element space can control event bubbling. Note\nthat the closure style actions cannot.\n\nEvents triggered through the action helper will automatically have\n`.preventDefault()` called on them. You do not need to do so in your event\nhandlers. If you need to allow event propagation (to handle file inputs for\nexample) you can supply the `preventDefault=false` option to the `{{action}}` helper:\n\n```handlebars\n<div {{action \"sayHello\" preventDefault=false}}>\n <input type=\"file\" />\n <input type=\"checkbox\" />\n</div>\n```\n\nTo disable bubbling, pass `bubbles=false` to the helper:\n\n```handlebars\n<button {{action 'edit' post bubbles=false}}>Edit</button>\n```\n\nTo disable bubbling with closure style actions you must create your own\nwrapper helper that makes use of `event.stopPropagation()`:\n\n```handlebars\n<div onclick={{disable-bubbling (action \"sayHello\")}}>Hello</div>\n```\n\n```app/helpers/disable-bubbling.js\nimport { helper } from '@ember/component/helper';\n\nexport function disableBubbling([action]) {\n return function(event) {\n event.stopPropagation();\n return action(event);\n };\n}\nexport default helper(disableBubbling);\n```\n\nIf you need the default handler to trigger you should either register your\nown event handler, or use event methods on your view class. See\n[\"Responding to Browser Events\"](/ember/release/classes/Component)\nin the documentation for `Component` for more information.\n\n### Specifying DOM event type\n\n`{{action}}` helpers called in element space can specify an event type.\nBy default the `{{action}}` helper registers for DOM `click` events. You can\nsupply an `on` option to the helper to specify a different DOM event name:\n\n```handlebars\n<div {{action \"anActionName\" on=\"doubleClick\"}}>\n click me\n</div>\n```\n\nSee [\"Event Names\"](/ember/release/classes/Component) for a list of\nacceptable DOM event names.\n\n### Specifying whitelisted modifier keys\n\n`{{action}}` helpers called in element space can specify modifier keys.\nBy default the `{{action}}` helper will ignore click events with pressed modifier\nkeys. You can supply an `allowedKeys` option to specify which keys should not be ignored.\n\n```handlebars\n<div {{action \"anActionName\" allowedKeys=\"alt\"}}>\n click me\n</div>\n```\n\nThis way the action will fire when clicking with the alt key pressed down.\nAlternatively, supply \"any\" to the `allowedKeys` option to accept any combination of modifier keys.\n\n```handlebars\n<div {{action \"anActionName\" allowedKeys=\"any\"}}>\n click me with any key pressed\n</div>\n```\n\n### Specifying a Target\n\nA `target` option can be provided to the helper to change\nwhich object will receive the method call. This option must be a path\nto an object, accessible in the current context:\n\n```app/templates/application.hbs\n<div {{action \"anActionName\" target=someService}}>\n click me\n</div>\n```\n\n```app/controllers/application.js\nimport Controller from '@ember/controller';\nimport { service } from '@ember/service';\n\nexport default class extends Controller {\n @service someService;\n}\n```",
|
|
6297
6304
|
"itemtype": "method",
|
|
6298
6305
|
"name": "action",
|
|
6299
6306
|
"access": "public",
|
|
@@ -7000,7 +7007,7 @@
|
|
|
7000
7007
|
{
|
|
7001
7008
|
"file": "packages/@ember/-internals/glimmer/lib/helper.ts",
|
|
7002
7009
|
"line": 91,
|
|
7003
|
-
"description": "On a class-based helper, it may be useful to force a recomputation of that\nhelpers value. This is akin to `rerender` on a component.\n\nFor example, this component will rerender when the `currentUser` on a\nsession service changes:\n\n```app/helpers/current-user-email.js\nimport Helper from '@ember/component/helper'\nimport {
|
|
7010
|
+
"description": "On a class-based helper, it may be useful to force a recomputation of that\nhelpers value. This is akin to `rerender` on a component.\n\nFor example, this component will rerender when the `currentUser` on a\nsession service changes:\n\n```app/helpers/current-user-email.js\nimport Helper from '@ember/component/helper'\nimport { service } from '@ember/service'\nimport { observer } from '@ember/object'\n\nexport default Helper.extend({\n session: service(),\n\n onNewUser: observer('session.currentUser', function() {\n this.recompute();\n }),\n\n compute() {\n return this.get('session.currentUser.email');\n }\n});\n```",
|
|
7004
7011
|
"itemtype": "method",
|
|
7005
7012
|
"name": "recompute",
|
|
7006
7013
|
"access": "public",
|
|
@@ -7202,6 +7209,16 @@
|
|
|
7202
7209
|
"class": "@glimmer/tracking/primitives/cache",
|
|
7203
7210
|
"module": "@glimmer/tracking/primitives/cache"
|
|
7204
7211
|
},
|
|
7212
|
+
{
|
|
7213
|
+
"file": "packages/@ember/-internals/metal/lib/cached.ts",
|
|
7214
|
+
"line": 8,
|
|
7215
|
+
"decorator": "The `@cached` decorator can be used on getters in order to cache the return\nvalue of the getter. This is useful when a getter is expensive and used very\noften.",
|
|
7216
|
+
"example": [
|
|
7217
|
+
"\n\nin this guest list class, we have the `sortedGuests`\ngetter that sorts the guests alphabetically:\n\n```js\nimport { tracked } from '@glimmer/tracking';\n\nclass GuestList {\n @tracked guests = ['Zoey', 'Tomster'];\n\n get sortedGuests() {\n return this.guests.slice().sort()\n }\n}\n```\n\nEvery time `sortedGuests` is accessed, a new array will be created and sorted,\nbecause JavaScript getters do not cache by default. When the guest list is\nsmall, like the one in the example, this is not a problem. However, if the guest\nlist were to grow very large, it would mean that we would be doing a large\namount of work each time we accessed `sortedGetters`. With `@cached`, we can\ncache the value instead:\n\n```js\nimport { tracked, cached } from '@glimmer/tracking';\n\nclass GuestList {\n @tracked guests = ['Zoey', 'Tomster'];\n\n @cached\n get sortedGuests() {\n return this.guests.slice().sort()\n }\n}\n```\n\nNow the `sortedGuests` getter will be cached based on _autotracking_. It will\nonly rerun and create a new sorted array when the `guests` tracked property is\nupdated.\n\nIn general, you should avoid using `@cached` unless you have confirmed that the\ngetter you are decorating is computationally expensive. `@cached` adds a small\namount of overhead to the getter, making it more expensive. While this overhead\nis small, if `@cached` is overused it can add up to a large impact overall in\nyour app. Many getters and tracked properties are only accessed once, rendered,\nand then never rerendered, so adding `@cached` when it is unnecessary can\nnegatively impact performance."
|
|
7218
|
+
],
|
|
7219
|
+
"class": "ComputedProperty",
|
|
7220
|
+
"module": "@glimmer/tracking/primitives/cache"
|
|
7221
|
+
},
|
|
7205
7222
|
{
|
|
7206
7223
|
"file": "packages/@ember/-internals/metal/lib/computed.ts",
|
|
7207
7224
|
"line": 583,
|
|
@@ -8822,7 +8839,7 @@
|
|
|
8822
8839
|
{
|
|
8823
8840
|
"file": "packages/@ember/-internals/routing/lib/services/router.ts",
|
|
8824
8841
|
"line": 71,
|
|
8825
|
-
"description": "Transition the application into another route. The route may\nbe either a single route or route path:\n\nSee [transitionTo](/ember/release/classes/Route/methods/transitionTo?anchor=transitionTo) for more info.\n\nCalling `transitionTo` from the Router service will cause default query parameter values to be included in the URL.\nThis behavior is different from calling `transitionTo` on a route or `transitionToRoute` on a controller.\nSee the [Router Service RFC](https://github.com/emberjs/rfcs/blob/master/text/0095-router-service.md#query-parameter-semantics) for more info.\n\nIn the following example we use the Router service to navigate to a route with a\nspecific model from a Component in the first action, and in the second we trigger\na query-params only transition.\n\n```app/components/example.js\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport {
|
|
8842
|
+
"description": "Transition the application into another route. The route may\nbe either a single route or route path:\n\nSee [transitionTo](/ember/release/classes/Route/methods/transitionTo?anchor=transitionTo) for more info.\n\nCalling `transitionTo` from the Router service will cause default query parameter values to be included in the URL.\nThis behavior is different from calling `transitionTo` on a route or `transitionToRoute` on a controller.\nSee the [Router Service RFC](https://github.com/emberjs/rfcs/blob/master/text/0095-router-service.md#query-parameter-semantics) for more info.\n\nIn the following example we use the Router service to navigate to a route with a\nspecific model from a Component in the first action, and in the second we trigger\na query-params only transition.\n\n```app/components/example.js\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { service } from '@ember/service';\n\nexport default class extends Component {\n @service router;\n\n @action\n goToComments(post) {\n this.router.transitionTo('comments', post);\n }\n\n @action\n fetchMoreComments(latestComment) {\n this.router.transitionTo({\n queryParams: { commentsAfter: latestComment }\n });\n }\n}\n```",
|
|
8826
8843
|
"itemtype": "method",
|
|
8827
8844
|
"name": "transitionTo",
|
|
8828
8845
|
"params": [
|
|
@@ -8890,7 +8907,7 @@
|
|
|
8890
8907
|
{
|
|
8891
8908
|
"file": "packages/@ember/-internals/routing/lib/services/router.ts",
|
|
8892
8909
|
"line": 174,
|
|
8893
|
-
"description": "Generate a URL based on the supplied route name and optionally a model. The\nURL is returned as a string that can be used for any purpose.\n\nIn this example, the URL for the `author.books` route for a given author\nis copied to the clipboard.\n\n```app/templates/application.hbs\n<CopyLink @author={{hash id=\"tomster\" name=\"Tomster\"}} />\n```\n\n```app/components/copy-link.js\nimport Component from '@glimmer/component';\nimport {
|
|
8910
|
+
"description": "Generate a URL based on the supplied route name and optionally a model. The\nURL is returned as a string that can be used for any purpose.\n\nIn this example, the URL for the `author.books` route for a given author\nis copied to the clipboard.\n\n```app/templates/application.hbs\n<CopyLink @author={{hash id=\"tomster\" name=\"Tomster\"}} />\n```\n\n```app/components/copy-link.js\nimport Component from '@glimmer/component';\nimport { service } from '@ember/service';\nimport { action } from '@ember/object';\n\nexport default class CopyLinkComponent extends Component {\n @service router;\n @service clipboard;\n\n @action\n copyBooksURL() {\n if (this.author) {\n const url = this.router.urlFor('author.books', this.args.author);\n this.clipboard.set(url);\n // Clipboard now has /author/tomster/books\n }\n }\n}\n```\n\nJust like with `transitionTo` and `replaceWith`, `urlFor` can also handle\nquery parameters.\n\n```app/templates/application.hbs\n<CopyLink @author={{hash id=\"tomster\" name=\"Tomster\"}} />\n```\n\n```app/components/copy-link.js\nimport Component from '@glimmer/component';\nimport { service } from '@ember/service';\nimport { action } from '@ember/object';\n\nexport default class CopyLinkComponent extends Component {\n @service router;\n @service clipboard;\n\n @action\n copyOnlyEmberBooksURL() {\n if (this.author) {\n const url = this.router.urlFor('author.books', this.author, {\n queryParams: { filter: 'emberjs' }\n });\n this.clipboard.set(url);\n // Clipboard now has /author/tomster/books?filter=emberjs\n }\n }\n}\n```",
|
|
8894
8911
|
"itemtype": "method",
|
|
8895
8912
|
"name": "urlFor",
|
|
8896
8913
|
"params": [
|
|
@@ -8923,7 +8940,7 @@
|
|
|
8923
8940
|
{
|
|
8924
8941
|
"file": "packages/@ember/-internals/routing/lib/services/router.ts",
|
|
8925
8942
|
"line": 248,
|
|
8926
|
-
"description": "Returns `true` if `routeName/models/queryParams` is the active route, where `models` and `queryParams` are optional.\nSee [model](api/ember/release/classes/Route/methods/model?anchor=model) and\n[queryParams](/api/ember/3.7/classes/Route/properties/queryParams?anchor=queryParams) for more information about these arguments.\n\nIn the following example, `isActive` will return `true` if the current route is `/posts`.\n\n```app/components/posts.js\nimport Component from '@glimmer/component';\nimport {
|
|
8943
|
+
"description": "Returns `true` if `routeName/models/queryParams` is the active route, where `models` and `queryParams` are optional.\nSee [model](api/ember/release/classes/Route/methods/model?anchor=model) and\n[queryParams](/api/ember/3.7/classes/Route/properties/queryParams?anchor=queryParams) for more information about these arguments.\n\nIn the following example, `isActive` will return `true` if the current route is `/posts`.\n\n```app/components/posts.js\nimport Component from '@glimmer/component';\nimport { service } from '@ember/service';\n\nexport default class extends Component {\n @service router;\n\n displayComments() {\n return this.router.isActive('posts');\n }\n});\n```\n\nThe next example includes a dynamic segment, and will return `true` if the current route is `/posts/1`,\nassuming the post has an id of 1:\n\n```app/components/posts.js\nimport Component from '@glimmer/component';\nimport { service } from '@ember/service';\n\nexport default class extends Component {\n @service router;\n\n displayComments(post) {\n return this.router.isActive('posts', post.id);\n }\n});\n```\n\nWhere `post.id` is the id of a specific post, which is represented in the route as /posts/[post.id].\nIf `post.id` is equal to 1, then isActive will return true if the current route is /posts/1, and false if the route is anything else.",
|
|
8927
8944
|
"itemtype": "method",
|
|
8928
8945
|
"name": "isActive",
|
|
8929
8946
|
"params": [
|
|
@@ -8956,7 +8973,7 @@
|
|
|
8956
8973
|
{
|
|
8957
8974
|
"file": "packages/@ember/-internals/routing/lib/services/router.ts",
|
|
8958
8975
|
"line": 345,
|
|
8959
|
-
"description": "Takes a string URL and returns a `RouteInfo` for the leafmost route represented\nby the URL. Returns `null` if the URL is not recognized. This method expects to\nreceive the actual URL as seen by the browser including the app's `rootURL`.\n\nSee [RouteInfo](/ember/release/classes/RouteInfo) for more info.\n\nIn the following example `recognize` is used to verify if a path belongs to our\napplication before transitioning to it.\n\n```\nimport Component from '@ember/component';\nimport {
|
|
8976
|
+
"description": "Takes a string URL and returns a `RouteInfo` for the leafmost route represented\nby the URL. Returns `null` if the URL is not recognized. This method expects to\nreceive the actual URL as seen by the browser including the app's `rootURL`.\n\nSee [RouteInfo](/ember/release/classes/RouteInfo) for more info.\n\nIn the following example `recognize` is used to verify if a path belongs to our\napplication before transitioning to it.\n\n```\nimport Component from '@ember/component';\nimport { service } from '@ember/service';\n\nexport default class extends Component {\n @service router;\n path = '/';\n\n click() {\n if (this.router.recognize(this.path)) {\n this.router.transitionTo(this.path);\n }\n }\n}\n```",
|
|
8960
8977
|
"itemtype": "method",
|
|
8961
8978
|
"name": "recognize",
|
|
8962
8979
|
"params": [
|
|
@@ -8992,7 +9009,7 @@
|
|
|
8992
9009
|
{
|
|
8993
9010
|
"file": "packages/@ember/-internals/routing/lib/services/router.ts",
|
|
8994
9011
|
"line": 406,
|
|
8995
|
-
"description": "The `routeWillChange` event is fired at the beginning of any\nattempted transition with a `Transition` object as the sole\nargument. This action can be used for aborting, redirecting,\nor decorating the transition from the currently active routes.\n\nA good example is preventing navigation when a form is\nhalf-filled out:\n\n```app/routes/contact-form.js\nimport Route from '@ember/routing';\nimport {
|
|
9012
|
+
"description": "The `routeWillChange` event is fired at the beginning of any\nattempted transition with a `Transition` object as the sole\nargument. This action can be used for aborting, redirecting,\nor decorating the transition from the currently active routes.\n\nA good example is preventing navigation when a form is\nhalf-filled out:\n\n```app/routes/contact-form.js\nimport Route from '@ember/routing';\nimport { service } from '@ember/service';\n\nexport default class extends Route {\n @service router;\n\n constructor() {\n super(...arguments);\n\n this.router.on('routeWillChange', (transition) => {\n if (!transition.to.find(route => route.name === this.routeName)) {\n alert(\"Please save or cancel your changes.\");\n transition.abort();\n }\n })\n }\n}\n```\n\nThe `routeWillChange` event fires whenever a new route is chosen as the desired target of a transition. This includes `transitionTo`, `replaceWith`, all redirection for any reason including error handling, and abort. Aborting implies changing the desired target back to where you already were. Once a transition has completed, `routeDidChange` fires.",
|
|
8996
9013
|
"itemtype": "event",
|
|
8997
9014
|
"name": "routeWillChange",
|
|
8998
9015
|
"params": [
|
|
@@ -9010,7 +9027,7 @@
|
|
|
9010
9027
|
{
|
|
9011
9028
|
"file": "packages/@ember/-internals/routing/lib/services/router.ts",
|
|
9012
9029
|
"line": 442,
|
|
9013
|
-
"description": "The `routeDidChange` event only fires once a transition has settled.\nThis includes aborts and error substates. Like the `routeWillChange` event\nit receives a Transition as the sole argument.\n\nA good example is sending some analytics when the route has transitioned:\n\n```app/routes/contact-form.js\nimport Route from '@ember/routing';\nimport {
|
|
9030
|
+
"description": "The `routeDidChange` event only fires once a transition has settled.\nThis includes aborts and error substates. Like the `routeWillChange` event\nit receives a Transition as the sole argument.\n\nA good example is sending some analytics when the route has transitioned:\n\n```app/routes/contact-form.js\nimport Route from '@ember/routing';\nimport { service } from '@ember/service';\n\nexport default class extends Route {\n @service router;\n\n constructor() {\n super(...arguments);\n\n this.router.on('routeDidChange', (transition) => {\n ga.send('pageView', {\n current: transition.to.name,\n from: transition.from.name\n });\n })\n }\n}\n```\n\n`routeDidChange` will be called after any `Route`'s\n[didTransition](/ember/release/classes/Route/events/didTransition?anchor=didTransition)\naction has been fired.\nThe updates of properties\n[currentURL](/ember/release/classes/RouterService/properties/currentURL?anchor=currentURL),\n[currentRouteName](/ember/release/classes/RouterService/properties/currentURL?anchor=currentRouteName)\nand\n[currentRoute](/ember/release/classes/RouterService/properties/currentURL?anchor=currentRoute)\nare completed at the time `routeDidChange` is called.",
|
|
9014
9031
|
"itemtype": "event",
|
|
9015
9032
|
"name": "routeDidChange",
|
|
9016
9033
|
"params": [
|
|
@@ -9104,7 +9121,7 @@
|
|
|
9104
9121
|
{
|
|
9105
9122
|
"file": "packages/@ember/-internals/routing/lib/services/router.ts",
|
|
9106
9123
|
"line": 645,
|
|
9107
|
-
"description": "The `currentRoute` property contains metadata about the current leaf route.\nIt returns a `RouteInfo` object that has information like the route name,\nparams, query params and more.\n\nSee [RouteInfo](/ember/release/classes/RouteInfo) for more info.\n\nThis property is guaranteed to change whenever a route transition\nhappens (even when that transition only changes parameters\nand doesn't change the active route).\n\nUsage example:\n```app/components/header.js\n import Component from '@glimmer/component';\n import {
|
|
9124
|
+
"description": "The `currentRoute` property contains metadata about the current leaf route.\nIt returns a `RouteInfo` object that has information like the route name,\nparams, query params and more.\n\nSee [RouteInfo](/ember/release/classes/RouteInfo) for more info.\n\nThis property is guaranteed to change whenever a route transition\nhappens (even when that transition only changes parameters\nand doesn't change the active route).\n\nUsage example:\n```app/components/header.js\n import Component from '@glimmer/component';\n import { service } from '@ember/service';\n import { notEmpty } from '@ember/object/computed';\n\n export default class extends Component {\n @service router;\n\n @notEmpty('router.currentRoute.child') isChildRoute;\n });\n```",
|
|
9108
9125
|
"itemtype": "property",
|
|
9109
9126
|
"name": "currentRoute",
|
|
9110
9127
|
"type": "RouteInfo",
|
|
@@ -10288,7 +10305,7 @@
|
|
|
10288
10305
|
{
|
|
10289
10306
|
"file": "packages/@ember/-internals/routing/lib/system/route.ts",
|
|
10290
10307
|
"line": 1664,
|
|
10291
|
-
"description": "Allows you to produce custom metadata for the route.\nThe return value of this method will be attached to\nits corresponding RouteInfoWithAttributes object.\n\nExample\n\n```app/routes/posts/index.js\nimport Route from '@ember/routing/route';\n\nexport default class PostsIndexRoute extends Route {\n buildRouteInfoMetadata() {\n return { title: 'Posts Page' }\n }\n}\n```\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport {
|
|
10308
|
+
"description": "Allows you to produce custom metadata for the route.\nThe return value of this method will be attached to\nits corresponding RouteInfoWithAttributes object.\n\nExample\n\n```app/routes/posts/index.js\nimport Route from '@ember/routing/route';\n\nexport default class PostsIndexRoute extends Route {\n buildRouteInfoMetadata() {\n return { title: 'Posts Page' }\n }\n}\n```\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport { service } from '@ember/service';\n\nexport default class ApplicationRoute extends Route {\n @service router\n\n constructor() {\n super(...arguments);\n\n this.router.on('routeDidChange', transition => {\n document.title = transition.to.metadata.title;\n // would update document's title to \"Posts Page\"\n });\n }\n}\n```",
|
|
10292
10309
|
"itemtype": "method",
|
|
10293
10310
|
"name": "buildRouteInfoMetadata",
|
|
10294
10311
|
"return": {
|
|
@@ -10854,7 +10871,7 @@
|
|
|
10854
10871
|
{
|
|
10855
10872
|
"file": "packages/@ember/-internals/routing/lib/system/router.ts",
|
|
10856
10873
|
"line": 1378,
|
|
10857
|
-
"description": "Handles updating the paths and notifying any listeners of the URL\nchange.\n\nTriggers the router level `didTransition` hook.\n\nFor example, to notify google analytics when the route changes,\nyou could use this hook. (Note: requires also including GA scripts, etc.)\n\n```javascript\nimport config from './config/environment';\nimport EmberRouter from '@ember/routing/router';\nimport {
|
|
10874
|
+
"description": "Handles updating the paths and notifying any listeners of the URL\nchange.\n\nTriggers the router level `didTransition` hook.\n\nFor example, to notify google analytics when the route changes,\nyou could use this hook. (Note: requires also including GA scripts, etc.)\n\n```javascript\nimport config from './config/environment';\nimport EmberRouter from '@ember/routing/router';\nimport { service } from '@ember/service';\n\nlet Router = EmberRouter.extend({\n location: config.locationType,\n\n router: service(),\n\n didTransition: function() {\n this._super(...arguments);\n\n ga('send', 'pageview', {\n page: this.router.currentURL,\n title: this.router.currentRouteName,\n });\n }\n});\n```",
|
|
10858
10875
|
"itemtype": "method",
|
|
10859
10876
|
"name": "didTransition",
|
|
10860
10877
|
"access": "public",
|
|
@@ -15444,7 +15461,7 @@
|
|
|
15444
15461
|
{
|
|
15445
15462
|
"file": "packages/@ember/application/lib/application.js",
|
|
15446
15463
|
"line": 882,
|
|
15447
|
-
"description": "Boot a new instance of `ApplicationInstance` for the current\napplication and navigate it to the given `url`. Returns a `Promise` that\nresolves with the instance when the initial routing and rendering is\ncomplete, or rejects with any error that occurred during the boot process.\n\nWhen `autoboot` is disabled, calling `visit` would first cause the\napplication to boot, which runs the application initializers.\n\nThis method also takes a hash of boot-time configuration options for\ncustomizing the instance's behavior. See the documentation on\n`ApplicationInstance.BootOptions` for details.\n\n`ApplicationInstance.BootOptions` is an interface class that exists\npurely to document the available options; you do not need to construct it\nmanually. Simply pass a regular JavaScript object containing of the\ndesired options:\n\n```javascript\nMyApp.visit(\"/\", { location: \"none\", rootElement: \"#container\" });\n```\n\n### Supported Scenarios\n\nWhile the `BootOptions` class exposes a large number of knobs, not all\ncombinations of them are valid; certain incompatible combinations might\nresult in unexpected behavior.\n\nFor example, booting the instance in the full browser environment\nwhile specifying a foreign `document` object (e.g. `{ isBrowser: true,\ndocument: iframe.contentDocument }`) does not work correctly today,\nlargely due to Ember's jQuery dependency.\n\nCurrently, there are three officially supported scenarios/configurations.\nUsages outside of these scenarios are not guaranteed to work, but please\nfeel free to file bug reports documenting your experience and any issues\nyou encountered to help expand support.\n\n#### Browser Applications (Manual Boot)\n\nThe setup is largely similar to how Ember works out-of-the-box. Normally,\nEmber will boot a default instance for your Application on \"DOM ready\".\nHowever, you can customize this behavior by disabling `autoboot`.\n\nFor example, this allows you to render a miniture demo of your application\ninto a specific area on your marketing website:\n\n```javascript\nimport MyApp from 'my-app';\n\n$(function() {\n let App = MyApp.create({ autoboot: false });\n\n let options = {\n // Override the router's location adapter to prevent it from updating\n // the URL in the address bar\n location: 'none',\n\n // Override the default `rootElement` on the app to render into a\n // specific `div` on the page\n rootElement: '#demo'\n };\n\n // Start the app at the special demo URL\n App.visit('/demo', options);\n});\n```\n\nOr perhaps you might want to boot two instances of your app on the same\npage for a split-screen multiplayer experience:\n\n```javascript\nimport MyApp from 'my-app';\n\n$(function() {\n let App = MyApp.create({ autoboot: false });\n\n let sessionId = MyApp.generateSessionID();\n\n let player1 = App.visit(`/matches/join?name=Player+1&session=${sessionId}`, { rootElement: '#left', location: 'none' });\n let player2 = App.visit(`/matches/join?name=Player+2&session=${sessionId}`, { rootElement: '#right', location: 'none' });\n\n Promise.all([player1, player2]).then(() => {\n // Both apps have completed the initial render\n $('#loading').fadeOut();\n });\n});\n```\n\nDo note that each app instance maintains their own registry/container, so\nthey will run in complete isolation by default.\n\n#### Server-Side Rendering (also known as FastBoot)\n\nThis setup allows you to run your Ember app in a server environment using\nNode.js and render its content into static HTML for SEO purposes.\n\n```javascript\nconst HTMLSerializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap);\n\nfunction renderURL(url) {\n let dom = new SimpleDOM.Document();\n let rootElement = dom.body;\n let options = { isBrowser: false, document: dom, rootElement: rootElement };\n\n return MyApp.visit(options).then(instance => {\n try {\n return HTMLSerializer.serialize(rootElement.firstChild);\n } finally {\n instance.destroy();\n }\n });\n}\n```\n\nIn this scenario, because Ember does not have access to a global `document`\nobject in the Node.js environment, you must provide one explicitly. In practice,\nin the non-browser environment, the stand-in `document` object only needs to\nimplement a limited subset of the full DOM API. The `SimpleDOM` library is known\nto work.\n\nSince there is no access to jQuery in the non-browser environment, you must also\nspecify a DOM `Element` object in the same `document` for the `rootElement` option\n(as opposed to a selector string like `\"body\"`).\n\nSee the documentation on the `isBrowser`, `document` and `rootElement` properties\non `ApplicationInstance.BootOptions` for details.\n\n#### Server-Side Resource Discovery\n\nThis setup allows you to run the routing layer of your Ember app in a server\nenvironment using Node.js and completely disable rendering. This allows you\nto simulate and discover the resources (i.e. AJAX requests) needed to fulfill\na given request and eagerly \"push\" these resources to the client.\n\n```app/initializers/network-service.js\nimport BrowserNetworkService from 'app/services/network/browser';\nimport NodeNetworkService from 'app/services/network/node';\n\n// Inject a (hypothetical) service for abstracting all AJAX calls and use\n// the appropriate implementation on the client/server. This also allows the\n// server to log all the AJAX calls made during a particular request and use\n// that for resource-discovery purpose.\n\nexport function initialize(application) {\n if (window) { // browser\n application.register('service:network', BrowserNetworkService);\n } else { // node\n application.register('service:network', NodeNetworkService);\n }\n};\n\nexport default {\n name: 'network-service',\n initialize: initialize\n};\n```\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\nimport {
|
|
15464
|
+
"description": "Boot a new instance of `ApplicationInstance` for the current\napplication and navigate it to the given `url`. Returns a `Promise` that\nresolves with the instance when the initial routing and rendering is\ncomplete, or rejects with any error that occurred during the boot process.\n\nWhen `autoboot` is disabled, calling `visit` would first cause the\napplication to boot, which runs the application initializers.\n\nThis method also takes a hash of boot-time configuration options for\ncustomizing the instance's behavior. See the documentation on\n`ApplicationInstance.BootOptions` for details.\n\n`ApplicationInstance.BootOptions` is an interface class that exists\npurely to document the available options; you do not need to construct it\nmanually. Simply pass a regular JavaScript object containing of the\ndesired options:\n\n```javascript\nMyApp.visit(\"/\", { location: \"none\", rootElement: \"#container\" });\n```\n\n### Supported Scenarios\n\nWhile the `BootOptions` class exposes a large number of knobs, not all\ncombinations of them are valid; certain incompatible combinations might\nresult in unexpected behavior.\n\nFor example, booting the instance in the full browser environment\nwhile specifying a foreign `document` object (e.g. `{ isBrowser: true,\ndocument: iframe.contentDocument }`) does not work correctly today,\nlargely due to Ember's jQuery dependency.\n\nCurrently, there are three officially supported scenarios/configurations.\nUsages outside of these scenarios are not guaranteed to work, but please\nfeel free to file bug reports documenting your experience and any issues\nyou encountered to help expand support.\n\n#### Browser Applications (Manual Boot)\n\nThe setup is largely similar to how Ember works out-of-the-box. Normally,\nEmber will boot a default instance for your Application on \"DOM ready\".\nHowever, you can customize this behavior by disabling `autoboot`.\n\nFor example, this allows you to render a miniture demo of your application\ninto a specific area on your marketing website:\n\n```javascript\nimport MyApp from 'my-app';\n\n$(function() {\n let App = MyApp.create({ autoboot: false });\n\n let options = {\n // Override the router's location adapter to prevent it from updating\n // the URL in the address bar\n location: 'none',\n\n // Override the default `rootElement` on the app to render into a\n // specific `div` on the page\n rootElement: '#demo'\n };\n\n // Start the app at the special demo URL\n App.visit('/demo', options);\n});\n```\n\nOr perhaps you might want to boot two instances of your app on the same\npage for a split-screen multiplayer experience:\n\n```javascript\nimport MyApp from 'my-app';\n\n$(function() {\n let App = MyApp.create({ autoboot: false });\n\n let sessionId = MyApp.generateSessionID();\n\n let player1 = App.visit(`/matches/join?name=Player+1&session=${sessionId}`, { rootElement: '#left', location: 'none' });\n let player2 = App.visit(`/matches/join?name=Player+2&session=${sessionId}`, { rootElement: '#right', location: 'none' });\n\n Promise.all([player1, player2]).then(() => {\n // Both apps have completed the initial render\n $('#loading').fadeOut();\n });\n});\n```\n\nDo note that each app instance maintains their own registry/container, so\nthey will run in complete isolation by default.\n\n#### Server-Side Rendering (also known as FastBoot)\n\nThis setup allows you to run your Ember app in a server environment using\nNode.js and render its content into static HTML for SEO purposes.\n\n```javascript\nconst HTMLSerializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap);\n\nfunction renderURL(url) {\n let dom = new SimpleDOM.Document();\n let rootElement = dom.body;\n let options = { isBrowser: false, document: dom, rootElement: rootElement };\n\n return MyApp.visit(options).then(instance => {\n try {\n return HTMLSerializer.serialize(rootElement.firstChild);\n } finally {\n instance.destroy();\n }\n });\n}\n```\n\nIn this scenario, because Ember does not have access to a global `document`\nobject in the Node.js environment, you must provide one explicitly. In practice,\nin the non-browser environment, the stand-in `document` object only needs to\nimplement a limited subset of the full DOM API. The `SimpleDOM` library is known\nto work.\n\nSince there is no access to jQuery in the non-browser environment, you must also\nspecify a DOM `Element` object in the same `document` for the `rootElement` option\n(as opposed to a selector string like `\"body\"`).\n\nSee the documentation on the `isBrowser`, `document` and `rootElement` properties\non `ApplicationInstance.BootOptions` for details.\n\n#### Server-Side Resource Discovery\n\nThis setup allows you to run the routing layer of your Ember app in a server\nenvironment using Node.js and completely disable rendering. This allows you\nto simulate and discover the resources (i.e. AJAX requests) needed to fulfill\na given request and eagerly \"push\" these resources to the client.\n\n```app/initializers/network-service.js\nimport BrowserNetworkService from 'app/services/network/browser';\nimport NodeNetworkService from 'app/services/network/node';\n\n// Inject a (hypothetical) service for abstracting all AJAX calls and use\n// the appropriate implementation on the client/server. This also allows the\n// server to log all the AJAX calls made during a particular request and use\n// that for resource-discovery purpose.\n\nexport function initialize(application) {\n if (window) { // browser\n application.register('service:network', BrowserNetworkService);\n } else { // node\n application.register('service:network', NodeNetworkService);\n }\n};\n\nexport default {\n name: 'network-service',\n initialize: initialize\n};\n```\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\nimport { service } from '@ember/service';\n\n// An example of how the (hypothetical) service is used in routes.\n\nexport default class IndexRoute extends Route {\n @service network;\n\n model(params) {\n return this.network.fetch(`/api/posts/${params.post_id}.json`);\n }\n\n afterModel(post) {\n if (post.isExternalContent) {\n return this.network.fetch(`/api/external/?url=${post.externalURL}`);\n } else {\n return post;\n }\n }\n}\n```\n\n```javascript\n// Finally, put all the pieces together\n\nfunction discoverResourcesFor(url) {\n return MyApp.visit(url, { isBrowser: false, shouldRender: false }).then(instance => {\n let networkService = instance.lookup('service:network');\n return networkService.requests; // => { \"/api/posts/123.json\": \"...\" }\n });\n}\n```",
|
|
15448
15465
|
"access": "public",
|
|
15449
15466
|
"tagname": "",
|
|
15450
15467
|
"itemtype": "method",
|
|
@@ -15797,7 +15814,7 @@
|
|
|
15797
15814
|
},
|
|
15798
15815
|
{
|
|
15799
15816
|
"file": "packages/@ember/canary-features/index.ts",
|
|
15800
|
-
"line":
|
|
15817
|
+
"line": 38,
|
|
15801
15818
|
"description": "Determine whether the specified `feature` is enabled. Used by Ember's\nbuild tools to exclude experimental features from beta/stable builds.\n\nYou can define the following configuration options:\n\n* `EmberENV.ENABLE_OPTIONAL_FEATURES` - enable any features that have not been explicitly\n enabled/disabled.",
|
|
15802
15819
|
"itemtype": "method",
|
|
15803
15820
|
"name": "isEnabled",
|
|
@@ -18220,7 +18237,6 @@
|
|
|
18220
18237
|
{
|
|
18221
18238
|
"file": "packages/@ember/service/index.js",
|
|
18222
18239
|
"line": 9,
|
|
18223
|
-
"description": "Creates a property that lazily looks up a service in the container. There are\nno restrictions as to what objects a service can be injected into.\n\nExample:\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport { inject as service } from '@ember/service';\n\nexport default class ApplicationRoute extends Route {\n @service('auth') authManager;\n\n model() {\n return this.authManager.findCurrentUser();\n }\n}\n```\n\nClassic Class Example:\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport { inject as service } from '@ember/service';\n\nexport default Route.extend({\n authManager: service('auth'),\n\n model() {\n return this.get('authManager').findCurrentUser();\n }\n});\n```\n\nThis example will create an `authManager` property on the application route\nthat looks up the `auth` service in the container, making it easily accessible\nin the `model` hook.",
|
|
18224
18240
|
"itemtype": "method",
|
|
18225
18241
|
"name": "inject",
|
|
18226
18242
|
"static": 1,
|
|
@@ -18241,6 +18257,30 @@
|
|
|
18241
18257
|
"class": "@ember/service",
|
|
18242
18258
|
"module": "@ember/service"
|
|
18243
18259
|
},
|
|
18260
|
+
{
|
|
18261
|
+
"file": "packages/@ember/service/index.js",
|
|
18262
|
+
"line": 23,
|
|
18263
|
+
"description": "Creates a property that lazily looks up a service in the container. There are\nno restrictions as to what objects a service can be injected into.\n\nExample:\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport { service } from '@ember/service';\n\nexport default class ApplicationRoute extends Route {\n @service('auth') authManager;\n\n model() {\n return this.authManager.findCurrentUser();\n }\n}\n```\n\nClassic Class Example:\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport { service } from '@ember/service';\n\nexport default Route.extend({\n authManager: service('auth'),\n\n model() {\n return this.get('authManager').findCurrentUser();\n }\n});\n```\n\nThis example will create an `authManager` property on the application route\nthat looks up the `auth` service in the container, making it easily accessible\nin the `model` hook.",
|
|
18264
|
+
"itemtype": "method",
|
|
18265
|
+
"name": "service",
|
|
18266
|
+
"static": 1,
|
|
18267
|
+
"since": "4.1.0",
|
|
18268
|
+
"params": [
|
|
18269
|
+
{
|
|
18270
|
+
"name": "name",
|
|
18271
|
+
"description": "(optional) name of the service to inject, defaults to\n the property's name",
|
|
18272
|
+
"type": "String"
|
|
18273
|
+
}
|
|
18274
|
+
],
|
|
18275
|
+
"return": {
|
|
18276
|
+
"description": "injection decorator instance",
|
|
18277
|
+
"type": "ComputedDecorator"
|
|
18278
|
+
},
|
|
18279
|
+
"access": "public",
|
|
18280
|
+
"tagname": "",
|
|
18281
|
+
"class": "@ember/service",
|
|
18282
|
+
"module": "@ember/service"
|
|
18283
|
+
},
|
|
18244
18284
|
{
|
|
18245
18285
|
"file": "packages/@ember/string/index.ts",
|
|
18246
18286
|
"line": 80,
|
|
@@ -18894,6 +18934,10 @@
|
|
|
18894
18934
|
"message": "replacing incorrect tag: returns with return",
|
|
18895
18935
|
"line": " packages/@ember/-internals/container/lib/container.ts:191"
|
|
18896
18936
|
},
|
|
18937
|
+
{
|
|
18938
|
+
"message": "unknown tag: decorator",
|
|
18939
|
+
"line": " packages/@ember/-internals/metal/lib/cached.ts:8"
|
|
18940
|
+
},
|
|
18897
18941
|
{
|
|
18898
18942
|
"message": "unknown tag: decorator",
|
|
18899
18943
|
"line": " packages/@ember/-internals/metal/lib/tracked.ts:16"
|
|
@@ -19006,6 +19050,10 @@
|
|
|
19006
19050
|
"message": "Missing item type\nFlattening is based on a global revision counter. If the revision has\nbumped it means that somewhere in a class inheritance chain something has\nchanged, so we need to reflatten everything. This can only happen if:\n\n1. A meta has been flattened (listener has been called)\n2. The meta is a prototype meta with children who have inherited its\n listeners\n3. A new listener is subsequently added to the meta (e.g. via `.reopen()`)\n\nThis is a very rare occurrence, so while the counter is global it shouldn't\nbe updated very often in practice.",
|
|
19007
19051
|
"line": " packages/@ember/-internals/meta/lib/meta.ts:435"
|
|
19008
19052
|
},
|
|
19053
|
+
{
|
|
19054
|
+
"message": "Missing item type",
|
|
19055
|
+
"line": " packages/@ember/-internals/metal/lib/cached.ts:8"
|
|
19056
|
+
},
|
|
19009
19057
|
{
|
|
19010
19058
|
"message": "Missing item type\nPrimarily used for cases where we are redefining a class, e.g. mixins/reopen\nbeing applied later. Revalidates all the observers, resetting their tags.",
|
|
19011
19059
|
"line": " packages/@ember/-internals/metal/lib/observer.ts:154"
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const MergeTrees = require('broccoli-merge-trees');
|
|
4
4
|
const Funnel = require('broccoli-funnel');
|
|
5
5
|
const path = require('path');
|
|
6
|
-
const resolve = require('resolve');
|
|
7
6
|
const concatBundle = require('./concat-bundle');
|
|
8
7
|
const buildDebugMacroPlugin = require('./build-debug-macro-plugin');
|
|
9
8
|
const buildStripClassCallcheckPlugin = require('./build-strip-class-callcheck-plugin');
|
|
@@ -33,7 +32,6 @@ function add(paths, name, path) {
|
|
|
33
32
|
add(paths, 'prod', 'vendor/ember/ember.js');
|
|
34
33
|
add(paths, 'debug', 'vendor/ember/ember.js');
|
|
35
34
|
add(paths, 'testing', 'vendor/ember/ember-testing.js');
|
|
36
|
-
add(paths, 'jquery', 'vendor/ember/jquery/jquery.js');
|
|
37
35
|
|
|
38
36
|
add(
|
|
39
37
|
absolutePaths,
|
|
@@ -65,7 +63,6 @@ module.exports = {
|
|
|
65
63
|
name: 'ember-source',
|
|
66
64
|
paths,
|
|
67
65
|
absolutePaths,
|
|
68
|
-
_jqueryIntegrationEnabled: true,
|
|
69
66
|
_overrideTree: undefined,
|
|
70
67
|
|
|
71
68
|
included() {
|
|
@@ -95,25 +92,6 @@ module.exports = {
|
|
|
95
92
|
);
|
|
96
93
|
}
|
|
97
94
|
|
|
98
|
-
if (
|
|
99
|
-
optionalFeaturesMissing ||
|
|
100
|
-
typeof optionalFeatures.isFeatureExplicitlySet !== 'function'
|
|
101
|
-
) {
|
|
102
|
-
message.push(
|
|
103
|
-
'* Unable to detect if jquery-integration is explicitly set to a value, please update `@ember/optional-features` to the latest version'
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
optionalFeaturesMissing ||
|
|
109
|
-
(typeof optionalFeatures.isFeatureExplicitlySet === 'function' &&
|
|
110
|
-
!optionalFeatures.isFeatureExplicitlySet('jquery-integration'))
|
|
111
|
-
) {
|
|
112
|
-
message.push(
|
|
113
|
-
`* The jquery-integration optional feature should be explicitly set to a value under Octane, run \`ember feature:disable jquery-integration\` to disable it, or \`ember feature:enable jquery-integration\` to explicitly enable it`
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
95
|
if (
|
|
118
96
|
optionalFeaturesMissing ||
|
|
119
97
|
optionalFeatures.isFeatureEnabled('application-template-wrapper')
|
|
@@ -164,12 +142,15 @@ module.exports = {
|
|
|
164
142
|
}
|
|
165
143
|
}
|
|
166
144
|
|
|
167
|
-
|
|
168
|
-
optionalFeaturesMissing
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
145
|
+
if (
|
|
146
|
+
!optionalFeaturesMissing &&
|
|
147
|
+
optionalFeatures.isFeatureEnabled('jquery-integration') &&
|
|
148
|
+
typeof optionalFeatures.isFeatureExplicitlySet === 'function' &&
|
|
149
|
+
optionalFeatures.isFeatureExplicitlySet('jquery-integration')
|
|
150
|
+
) {
|
|
151
|
+
const SilentError = require('silent-error');
|
|
152
|
+
throw new SilentError(
|
|
153
|
+
'Setting the `jquery-integration` optional feature flag to `true` was deprecated in Ember 3.x and removed in Ember 4.0.0. You must add the `@ember/optional-features` addon and set this feature to `false`.\n\nFor more information, see the deprecation guide: https://deprecations.emberjs.com/v3.x/#toc_optional-feature-jquery-integration'
|
|
173
154
|
);
|
|
174
155
|
}
|
|
175
156
|
},
|
|
@@ -237,10 +218,7 @@ module.exports = {
|
|
|
237
218
|
false
|
|
238
219
|
);
|
|
239
220
|
|
|
240
|
-
let exclude = [
|
|
241
|
-
isProduction ? 'ember-testing/**' : null,
|
|
242
|
-
!this._jqueryIntegrationEnabled ? 'jquery' : null,
|
|
243
|
-
].filter((value) => value !== null);
|
|
221
|
+
let exclude = isProduction ? ['ember-testing/**'] : [];
|
|
244
222
|
|
|
245
223
|
let emberFiles = new MergeTrees([new Funnel(packages, { exclude }), dependencies, headerFiles]);
|
|
246
224
|
|
|
@@ -270,21 +248,6 @@ module.exports = {
|
|
|
270
248
|
},
|
|
271
249
|
|
|
272
250
|
treeForVendor(tree) {
|
|
273
|
-
let jqueryPath;
|
|
274
|
-
|
|
275
|
-
try {
|
|
276
|
-
jqueryPath = path.dirname(
|
|
277
|
-
resolve.sync('jquery/package.json', { basedir: this.project.root })
|
|
278
|
-
);
|
|
279
|
-
} catch (error) {
|
|
280
|
-
jqueryPath = path.dirname(require.resolve('jquery/package.json'));
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
let jquery = new Funnel(jqueryPath + '/dist', {
|
|
284
|
-
destDir: 'ember/jquery',
|
|
285
|
-
files: ['jquery.js'],
|
|
286
|
-
});
|
|
287
|
-
|
|
288
251
|
let templateCompiler = new Funnel(tree, {
|
|
289
252
|
destDir: 'ember',
|
|
290
253
|
include: ['ember-template-compiler.js', 'ember-template-compiler.map'],
|
|
@@ -319,6 +282,6 @@ module.exports = {
|
|
|
319
282
|
});
|
|
320
283
|
}
|
|
321
284
|
|
|
322
|
-
return debugTree(new MergeTrees([ember, templateCompiler
|
|
285
|
+
return debugTree(new MergeTrees([ember, templateCompiler]), 'vendor:final');
|
|
323
286
|
},
|
|
324
287
|
};
|