Sha256: 940777880007eedb3a858ca86219c442edf3b28682bbf913af0b3ebd77e02df7
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
import { get } from 'ember-metal'; import { info } from '@ember/debug'; import { DEBUG } from '@glimmer/env'; /** @module ember */ /** Generates a controller factory @for Ember @method generateControllerFactory @private */ export function generateControllerFactory(owner, controllerName) { let Factory = owner.factoryFor('controller:basic').class; Factory = Factory.extend({ toString() { return `(generated ${controllerName} controller)`; }, }); let fullName = `controller:${controllerName}`; owner.register(fullName, Factory); return Factory; } /** Generates and instantiates a controller extending from `controller:basic` if present, or `Controller` if not. @for Ember @method generateController @private @since 1.3.0 */ export default function generateController(owner, controllerName) { generateControllerFactory(owner, controllerName); let fullName = `controller:${controllerName}`; let instance = owner.lookup(fullName); if (DEBUG) { if (get(instance, 'namespace.LOG_ACTIVE_GENERATION')) { info(`generated -> ${fullName}`, { fullName }); } } return instance; }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.5.1.1 | dist/es/ember-routing/lib/system/generate_controller.js |
discourse-ember-source-3.5.1.0 | dist/dist/es/ember-routing/lib/system/generate_controller.js |