This is a plugin that only has a peer dependency to ember-source
. What piral-ember
brings to the table is a set of Pilet API extensions that can be used with piral
or piral-core
.
The set includes an Ember.js converter for any component registration, as well as a fromEmber
shortcut and a EmberExtension
component.
By default, these API extensions are not integrated in piral
, so you'd need to add them to your Piral instance.
The following functions are brought to the Pilet API.
Transforms a standard Ember.js component into a component that can be used in Piral, essentially wrapping it with a reference to the corresponding converter.
::: summary: For pilet authors
You can use the fromEmber
function from the Pilet API to convert your Ember.js components to components usable by your Piral instance.
Example use:
import { PiletApi } from '<name-of-piral-instance>';
import { Page } from './Page';
export function setup(piral: PiletApi) {
piral.registerPage('/sample', piral.fromEmber(Page));
}
Within Ember.js components the Piral Ember.js extension component can be used by referring to EmberExtension
, e.g.,
<ember-extension name="name-of-extension"></ember-extension>
Alternatively, if piral-ember
has not been added to the Piral instance you can install and use the package also from a pilet directly.
import { PiletApi } from '<name-of-piral-instance>';
import { fromEmber } from 'piral-ember/convert';
import { Page } from './Page';
export function setup(piral: PiletApi) {
piral.registerPage('/sample', fromEmber(Page));
}
:::
::: summary: For Piral instance developers
Using Ember.js with Piral is as simple as installing piral-ember
and ember-source@^3
.
import { createEmberApi } from 'piral-ember';
The integration looks like:
const instance = createInstance({
// important part
plugins: [createEmberApi()],
// ...
});
:::
Piral is released using the MIT license. For more information see the license file.