some mods

This commit is contained in:
Donnelly 2017-03-28 11:13:58 +01:00
parent 880bca423c
commit 108a365717

View File

@ -1,10 +1,9 @@
#Aurelia Cheat Sheet # Aurelia Cheat Sheet
## [Configuration and Startup](aurelia-doc://section/1/version/1.0.0) ## [Configuration and Startup](aurelia-doc://section/1/version/1.0.0)
### Bootstrapping Older Browsers
```html ```html
<code-listing heading="Bootstrapping Older Browsers">
<source-code lang="HTML">
<script src="jspm_packages/system.js"></script> <script src="jspm_packages/system.js"></script>
<script src="config.js"></script> <script src="config.js"></script>
<script> <script>
@ -14,15 +13,12 @@
SystemJS.import('aurelia-bootstrapper'); SystemJS.import('aurelia-bootstrapper');
}); });
</script> </script>
</source-code>
</code-listing>
``` ```
> Warning: Promises in Edge > Warning: Promises in Edge
> Currently, the Edge browser has a serious performance problem with its Promise implementation. This deficiency can greatly increase startup time of your app. If you are targeting the Edge browser, it is highly recommended that you use the [bluebird promise](http://bluebirdjs.com/docs/getting-started.html) library to replace Edge's native implementation. You can do this by simply referencing the library prior to loading system.js. > Currently, the Edge browser has a serious performance problem with its Promise implementation. This deficiency can greatly increase startup time of your app. If you are targeting the Edge browser, it is highly recommended that you use the [bluebird promise](http://bluebirdjs.com/docs/getting-started.html) library to replace Edge's native implementation. You can do this by simply referencing the library prior to loading system.js.
<code-listing heading="Standard Startup Configuration"> ### Standard Startup Configuration
<source-code lang="ES 2015/2016">
```javascript ```javascript
export function configure(aurelia) { export function configure(aurelia) {
aurelia.use aurelia.use
@ -32,9 +28,9 @@
aurelia.start().then(() => aurelia.setRoot()); aurelia.start().then(() => aurelia.setRoot());
} }
``` ```
</source-code> ---
<source-code lang="TypeScript">
```typescript ```typescript
import {Aurelia} from 'aurelia-framework'; import {Aurelia} from 'aurelia-framework';
export function configure(aurelia: Aurelia): void { export function configure(aurelia: Aurelia): void {
@ -45,11 +41,10 @@
aurelia.start().then(() => aurelia.setRoot()); aurelia.start().then(() => aurelia.setRoot());
} }
``` ```
</source-code>
</code-listing>
<code-listing heading="Explicit Startup Configuration"> ### Explicit Startup Configuration
<source-code lang="ES 2015/2016">
```javascript
import {LogManager} from 'aurelia-framework'; import {LogManager} from 'aurelia-framework';
import {ConsoleAppender} from 'aurelia-logging-console'; import {ConsoleAppender} from 'aurelia-logging-console';
@ -66,8 +61,12 @@
aurelia.start().then(() => aurelia.setRoot('app', document.body)); aurelia.start().then(() => aurelia.setRoot('app', document.body));
} }
</source-code> ```
<source-code lang="TypeScript">
---
```typescript
import {LogManager, Aurelia} from 'aurelia-framework'; import {LogManager, Aurelia} from 'aurelia-framework';
import {ConsoleAppender} from 'aurelia-logging-console'; import {ConsoleAppender} from 'aurelia-logging-console';
@ -84,11 +83,10 @@
aurelia.start().then(() => aurelia.setRoot('app', document.body)); aurelia.start().then(() => aurelia.setRoot('app', document.body));
} }
</source-code> ```
</code-listing>
<code-listing heading="Configuring A Feature"> ### Configuring A Feature
<source-code lang="ES 2015/2016"> ```jaavascript
export function configure(aurelia) { export function configure(aurelia) {
aurelia.use aurelia.use
.standardConfiguration() .standardConfiguration()
@ -97,8 +95,10 @@
aurelia.start().then(() => aurelia.setRoot()); aurelia.start().then(() => aurelia.setRoot());
} }
</source-code> ```
<source-code lang="TypeScript"> ---
```typescript
import {Aurelia} from 'aurelia-framework'; import {Aurelia} from 'aurelia-framework';
export function configure(aurelia: Aurelia): void { export function configure(aurelia: Aurelia): void {
@ -109,8 +109,7 @@
aurelia.start().then(() => aurelia.setRoot()); aurelia.start().then(() => aurelia.setRoot());
} }
</source-code> ```
</code-listing>
<code-listing heading="Installing a Plugin"> <code-listing heading="Installing a Plugin">
<source-code lang="ES 2015/2016"> <source-code lang="ES 2015/2016">