Turbo Charge Your Engine

core / Extended COMPOSABILITY

Core

 

/messaging

/messaging/thread/:id

Extended

/messaging/thread/:id

Demo

Engine Resolver

Core Resolver

/**
 * Looking for <engine>-ext/components/a-sweet-component
 * If it doesn't exist, check if it exists in <engine>/component/a-sweet-component
 *
 * coreResolver()
 * converts  '<engine>-ext/components/a-sweet-component'
 * into          '<engine>/components/a-sweet-component'
 *
 * Since core/<engine> is a dependency in extended, its assets can be found
 **/



moduleNameLookupPatterns: Ember.computed(function() {
  return Ember.A([
    this.mainModuleName,     // look for the module in main application
    this.defaultModuleName,  // if not in main, look for the module in the engine
    coreResolver             // if not in engine, look for the module in core engine
  ]);
})

Demo

 

Extending core Methods

Extending Methods

// 'extended/<engine>-ext/components/path-to-component'

import ModuleName from '<engine>/components/path-to-component';

export default ModuleName.extend({
  methodToOverride() {
    this._super(...arguments);
   
    // Now do custom things to method
  }
});

Demo

extending Views

"extending" Views

// extended/<engine>/addon/templates/application.hbs

{{component-in-your-engine
  anArgument=model.value
  anAction=(action "doSomething")}}

{{outlet}}
// core/<engine>/addon/templates/application.hbs

{{outlet}}
Made with Slides.com