Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. /** This file contains interfaces for lifecycle hooks that all HTML Behaviors (such as Views and Custom Elements) can use. */
  2. declare module 'aurelia/lifecycle/html-behavior-hooks' {
  3. import {View} from "aurelia-framework";
  4. /** the first Html Behavior hook, that is called after the constructor */
  5. export interface Created {
  6. /**
  7. * If the view-model implements the created callback it is invoked next.
  8. * If your behavior is a custom element, it's view has also been created and both the view-model and the view are connected to their controller.
  9. * The created callback will receive the instance of the "owningView".
  10. * This is the view that the component is declared inside of.
  11. * If the component itself has a view, this will be passed second.
  12. */
  13. created(owningView: View, myView: View): void;
  14. }
  15.  
  16. export interface Bind {
  17. /**
  18. * Databinding is then activated on the view and view-model.
  19. * If the view-model has a bind callback, it will be invoked at this time.
  20. * The "binding context" to which the component is being bound will be passed first.
  21. * An "override context" will be passed second.
  22. * The override context contains information used to traverse the parent hierarchy
  23. * and can also be used to add any contextual properties that the component wants to add.
  24. * It should be noted that when the view-model has implemented the bind callback,
  25. * the databinding framework will not invoke the changed handlers for the view-model's bindable properties until the "next" time those properties are updated.
  26. * If you need to perform specific post-processing on your bindable properties,
  27. * when implementing the bind callback, you should do so manually within the callback itself.
  28. */
  29. bind(bindingContext: Object, overrideContext: Object): void;
  30. }
  31.  
  32. /** called when component html is attached to the DOM */
  33. export interface Attached {
  34. /**
  35. * Next, the component is attached to the DOM (in document).
  36. * If the view-model has an attached callback, it will be invoked at this time.
  37. */
  38. attached(): void;
  39. }
  40.  
  41. export interface Detached {
  42. /**
  43. * At some point in the future, the component may be removed from the DOM.
  44. * If/When this happens, and if the view-model has a detached callback, this is when it will be invoked.
  45. */
  46. detached(): void;
  47. }
  48.  
  49. export interface Unbind {
  50. /**
  51. * After a component is detached, it's usually unbound.
  52. * If your view-model has the unbind callback, it will be invoked during this process.
  53. */
  54. unbind(): void;
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement