dothtml-interfaces 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dothtml-interfaces",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Dependency injection interfaces for DOTHtml.",
5
5
  "main": "src/index.d.ts",
6
6
  "types": "src/index.d.ts",
package/src/i-dot.d.ts CHANGED
@@ -52,7 +52,7 @@ export interface IDotDocument
52
52
  * @param callback The markup-generating callback.
53
53
  */
54
54
  iterate(n: number, callback: (i: number)=>DotContent): IDotDocument;
55
- each<T>(a: Array<T>|(()=>Array<T>)|{[key: string]: T}, callback: (x: T, i: number|string)=>DotContent): IDotDocument;
55
+ each<T>(a: Array<T>|{[key: string|number]: T}|IObservable<any, Array<T>|{[key: string|number]: T}>, callback: (x: T, i: string|number, k: string|number)=>DotContent): IDotDocument;
56
56
 
57
57
  /**
58
58
  * Removes the targeted document and everything in it.
@@ -234,6 +234,8 @@ export interface IDotCore extends IDotDocument
234
234
  css: IDotCss;
235
235
  bus: IEventBus;
236
236
  window: IDotWindowBuilder;
237
+
238
+ observe<Ti extends IObservable|Array<any>|{[key: string|number]: any}|string|number|boolean = any, To = Ti>(props: {value: Ti, key?: string, transformer?: (value: Ti)=>To}): IObservable<Ti, To>;
237
239
 
238
240
  component<T extends {new(...args: any[]): (IComponent)}>(ComponentClass: T): T&{new(...args: any[]): ({$: FrameworkItems})};
239
241
  }
@@ -8,7 +8,12 @@ export default interface IObservable<Ti = any, To = Ti>{
8
8
  getValue(): To;
9
9
  // Set the value.
10
10
  setValue(v: Ti);
11
- // Optional transformer that can .
11
+
12
+ // Key is used for observable array proxy bindings.
13
+ // If a key is provided, it's used to uniquely identify array elements.
14
+ // If a key is not provided, identification is done automatically by the framework by comparing object references.
15
+ key: string;
16
+ // Optional transformer that can transform the input.
12
17
  transformer?: (input: Ti)=>To;
13
18
  subscribeNode(node: IDotDocument): number;
14
19
  subscribeAttr(node: IDotDocument, attributeName: string): number;