spikijs 1.1.36 → 1.1.37
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 +1 -1
- package/spiki.d.ts +4 -8
package/package.json
CHANGED
package/spiki.d.ts
CHANGED
|
@@ -42,28 +42,24 @@ export interface SpikiInstance {
|
|
|
42
42
|
*/
|
|
43
43
|
destroy?(): void;
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
* Allows dynamic properties (e.g. variables from s-for).
|
|
47
|
-
*/
|
|
48
|
-
[key: string]: any;
|
|
49
45
|
}
|
|
50
46
|
|
|
51
47
|
/**
|
|
52
48
|
* Helper type for the data factory function.
|
|
53
49
|
* Ensures 'this' includes your data + Spiki internals.
|
|
54
50
|
*/
|
|
55
|
-
export type ComponentFactory<T
|
|
51
|
+
export type ComponentFactory<T> = () => T & ThisType<T & SpikiInstance>;
|
|
56
52
|
|
|
57
53
|
export interface Spiki {
|
|
58
54
|
/**
|
|
59
|
-
* Registers a new component with
|
|
55
|
+
* Registers a new component with a factory function.
|
|
60
56
|
* @param name Name matching 's-data' in HTML.
|
|
61
57
|
* @param factory Factory function returning state.
|
|
62
58
|
*/
|
|
63
|
-
data<T
|
|
59
|
+
data<T>(name: string, factory: ComponentFactory<T>): void;
|
|
64
60
|
|
|
65
61
|
/**
|
|
66
|
-
* Registers a new component with
|
|
62
|
+
* Registers a new component with one or more modules/factories.
|
|
67
63
|
* @param name Name matching 's-data' in HTML.
|
|
68
64
|
* @param modules Factory functions or objects returning/containing state.
|
|
69
65
|
*/
|