mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
added typings for morphdom (#26059)
* added typings for morphdom * removed the empty namespace
This commit is contained in:
committed by
Mohamed Hegazy
parent
09bf36d49d
commit
1ed824d9df
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for morphdom 2.3
|
||||
// Project: https://github.com/patrick-steele-idem/morphdom
|
||||
// Definitions by: arvitaly <https://github.com/arvitaly>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface MorphDomOptions {
|
||||
getNodeKey?: (node: Node) => any;
|
||||
onBeforeNodeAdded?: (node: Node) => Node;
|
||||
onNodeAdded?: (node: Node) => Node;
|
||||
onBeforeElUpdated?: (fromEl: HTMLElement, toEl: HTMLElement) => boolean;
|
||||
onElUpdated?: (el: HTMLElement) => void;
|
||||
onBeforeNodeDiscarded?: (node: Node) => boolean;
|
||||
onNodeDiscarded?: (node: Node) => void;
|
||||
onBeforeElChildrenUpdated?: (fromEl: HTMLElement, toEl: HTMLElement) => boolean;
|
||||
childrenOnly?: boolean;
|
||||
}
|
||||
|
||||
declare function morphdom(
|
||||
fromNode: Node,
|
||||
toNode: Node | string,
|
||||
options?: MorphDomOptions,
|
||||
): void;
|
||||
|
||||
export = morphdom;
|
||||
@@ -0,0 +1,20 @@
|
||||
import morphdom = require("morphdom");
|
||||
|
||||
declare var node1: Node;
|
||||
declare var node2: Node;
|
||||
declare var el1: HTMLElement;
|
||||
declare var el2: HTMLElement;
|
||||
|
||||
morphdom(node1, node2);
|
||||
morphdom(node1, node2, {});
|
||||
morphdom(node1, node2, {
|
||||
childrenOnly: true,
|
||||
getNodeKey: (node) => null,
|
||||
onBeforeElChildrenUpdated: (el1, el2) => true,
|
||||
onBeforeElUpdated: (el1, el2) => true,
|
||||
onBeforeNodeAdded: (node) => node1,
|
||||
onBeforeNodeDiscarded: (node) => false,
|
||||
onElUpdated: (el) => null,
|
||||
onNodeAdded: (node) => node2,
|
||||
onNodeDiscarded: (node) => null,
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"morphdom-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user