// from the garrettmills/daton project - lib/src/lifecycle/AppClass.tsimport Instantiable from '../../../di/src/type/Instantiable.ts'import {DependencyKey} from '../../../di/src/type/DependencyKey.ts'import {make} from '../../../di/src/global.ts'import Application from '../lifecycle/Application.ts'/** * Base type for a class that supports binding methods by string. */export interface Bindable {  get_bound_method(method_name: string): (...args: any[]) => any}/** * Returns true if the given object is bindable. * @param what * @return boolean */export function isBindable(what: any): what is Bindable {  return (    what    && typeof what.get_bound_method === 'function'    && what.get_bound_method.length === 1    && typeof what.get_bound_method('get_bound_method') === 'function'  )}/** * Base class for Daton-interactive classes. Provides helpful utilities for accessing * the underlying application and IoC container. */export default class AppClass {  /**   * Use the IoC container to create an instance of the given class.   * @param {Instantiable|DependencyKey} target - the key to instantiate   * @param {...any} parameters - parameters to pass to the constructor   */  protected static make<T>(target: Instantiable<T>|DependencyKey, ...parameters: any[]) {    return make(target, ...parameters)  }  /**   * Get the Daton app.   * @type Application   */  protected static get app() {    return make(Application)  }  /**   * Use the IoC container to create an instance of the given class.   * @param {Instantiable|DependencyKey} target - the key to instantiate   * @param {...any} parameters - parameters to pass to the constructor   */  protected make<T>(target: Instantiable<T>|DependencyKey, ...parameters: any[]) {    return make(target, ...parameters)  }  /**   * Get the Daton app.// from the garrettmills/daton project - lib/src/lifecycle/AppClass.tsimport Instantiable from '../../../di/src/type/Instantiable.ts'import {DependencyKey} from '../../../di/src/type/DependencyKey.ts'import {make} from '../../../di/src/global.ts'import Application from '../lifecycle/Application.ts'/** * Base type for a class that supports binding methods by string. */export interface Bindable {  get_bound_method(method_name: string): (...args: any[]) => any}/** * Returns true if the given object is bindable. * @param what * @return boolean */export function isBindable(what: any): what is Bindable {  return (    what    && typeof what.get_bound_method === 'function'    && what.get_bound_method.length === 1    && typeof what.get_bound_method('get_bound_method') === 'function'  )}/** * Base class for Daton-interactive classes. Provides helpful utilities for accessing * the underlying application and IoC container. */export default class AppClass {  /**   * Use the IoC container to create an instance of the given class.   * @param {Instantiable|DependencyKey} target - the key to instantiate   * @param {...any} parameters - parameters to pass to the constructor   */  protected static make<T>(target: Instantiable<T>|DependencyKey, ...parameters: any[]) {    return make(target, ...parameters)  }  /**   * Get the Daton app.   * @type Application   */  protected static get app() {    return make(Application)  }  /**   * Use the IoC container to create an instance of the given class.   * @param {Instantiable|DependencyKey} target - the key to instantiate   * @param {...any} parameters - parameters to pass to the constructor   */  protected make<T>(target: Instantiable<T>|DependencyKey, ...parameters: any[]) {    return make(target, ...parameters)  }  /**   * Get the Daton app.// from the garrettmills/daton project - lib/src/lifecycle/AppClass.tsimport Instantiable from '../../../di/src/type/Instantiable.ts'import {DependencyKey} from '../../../di/src/type/DependencyKey.ts'import {make} from '../../../di/src/global.ts'import Application from '../lifecycle/Application.ts'/** * Base type for a class that supports binding methods by string. */export interface Bindable {  get_bound_method(method_name: string): (...args: any[]) => any}/** * Returns true if the given object is bindable. * @param what * @return boolean */export function isBindable(what: any): what is Bindable {  return (    what    && typeof what.get_bound_method === 'function'    && what.get_bound_method.length === 1    && typeof what.get_bound_method('get_bound_method') === 'function'  )}/** * Base class for Daton-interactive classes. Provides helpful utilities for accessing * the underlying application and IoC container. */export default class AppClass {  /**   * Use the IoC container to create an instance of the given class.   * @param {Instantiable|DependencyKey} target - the key to instantiate   * @param {...any} parameters - parameters to pass to the constructor   */  protected static make<T>(target: Instantiable<T>|DependencyKey, ...parameters: any[]) {    return make(target, ...parameters)  }  /**   * Get the Daton app.   * @type Application   */  protected static get app() {    return make(Application)  }  /**   * Use the IoC container to create an instance of the given class.   * @param {Instantiable|DependencyKey} target - the key to instantiate   * @param {...any} parameters - parameters to pass to the constructor   */  protected make<T>(target: Instantiable<T>|DependencyKey, ...parameters: any[]) {    return make(target, ...parameters)  }  /**   * Get the Daton app.

Snippet: pdfsearch

Garrett Mills
Copyright © 2021 Garrett Mills