Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zewa666/durelia
A simple Durandal (AMD) VM Wrapper for the Aurelia Framework
https://github.com/zewa666/durelia
Last synced: about 12 hours ago
JSON representation
A simple Durandal (AMD) VM Wrapper for the Aurelia Framework
- Host: GitHub
- URL: https://github.com/zewa666/durelia
- Owner: zewa666
- License: wtfpl
- Created: 2015-03-06T15:16:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-03-06T18:04:35.000Z (over 9 years ago)
- Last Synced: 2023-04-06T14:20:36.246Z (over 1 year ago)
- Language: JavaScript
- Size: 103 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## Durelia
A simple Durandal (AMD) VM Wrapper for the [Aurelia Framework](http://aurelia.io)
## Installation
1. Open up your terminal and go into your projects root
2. Type following command:```
jspm install github:zewa666/durelia
```
3. Copy a DurandalVM into your Project (e.g. `root/amd/testmodule.js`)
4. Create a new AureliaVM inside `src` (e.g. `src/testmodule.js`)
5. (Optional) Create a View for your new VM (e.g. `src/testmodule.html`)
6. Add this code into your AureliaVM:```
// Importing Durelia's wrapper
import {Wrapper} from 'durelia';// create a local instance of your DurandalVM
let VM = new Wrapper('../amd/testmodule');// export as function so router nows how to use your VM
export let TestModule = () => { return VM; };
```> You can pass a second argument to Wrapper which is the path to the View you'd like to leverage. If none is provided, following Aurelia's convention, a View with the same name as the module will be taken.
## Knockout support
The updated version provides support for Knockout. If your Durandal VMs contain references to Knockout (take a look at the [unit test stub](https://github.com/zewa666/durelia/blob/master/test/amd/ko_vm.js)), you have to do one additional step.
1. Open the file `config.js` of your project
2. In the System.config.paths section add this line at the end:```
"knockout": "jspm_packages/github/zewa666/durelia@master/test/knockout.js"
```so it looks like:
```
System.config({
"paths": {
"*": "*.js",
"github:*": "jspm_packages/github/*.js",
"npm:*": "jspm_packages/npm/*.js",
...
"knockout": "jspm_packages/github/zewa666/durelia@master/test/knockout.js"
}
});
```This will add a Polyfill for Knockout, which translates Observables and ObservableArray back to the original value.