-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dist directory relocate-living-docs-elements
- Loading branch information
Showing
10 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare function relocateLivingDocsElements(elementIdPrefix: string, elementIds: string[], targetElement: HTMLElement): void; | ||
export { relocateLivingDocsElements }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.relocateLivingDocsElements = void 0; | ||
function relocateLivingDocsElements(elementIdPrefix, elementIds, targetElement) { | ||
const updateInterval = 300; | ||
let intervalId; | ||
let intervalLimit = updateInterval * 20; | ||
intervalId = setInterval(() => { | ||
elementIds.forEach((elementId) => { | ||
const element = document.querySelector(`#${elementIdPrefix}-${elementId}`); | ||
if (element) { | ||
element.parentNode.removeChild(element); | ||
targetElement.appendChild(element); | ||
elementIds = elementIds.filter((id) => id !== elementId); | ||
} | ||
else { | ||
console.warn(`Element with Id: ${elementId} not found yet.`); | ||
} | ||
}); | ||
if (elementIds.length < 1 || intervalLimit <= 0) { | ||
clearInterval(intervalId); | ||
} | ||
intervalLimit -= updateInterval; | ||
}, updateInterval); | ||
} | ||
exports.relocateLivingDocsElements = relocateLivingDocsElements; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./Service"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"use strict"; | ||
// Note: Export all your code in here, that should be exposed to the consumer | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// e.g. Exports all exports of the Service.ts file | ||
__exportStar(require("./Service"), exports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "commonjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare function relocateLivingDocsElements(elementIdPrefix: string, elementIds: string[], targetElement: HTMLElement): void; | ||
export { relocateLivingDocsElements }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function relocateLivingDocsElements(elementIdPrefix, elementIds, targetElement) { | ||
const updateInterval = 300; | ||
let intervalId; | ||
let intervalLimit = updateInterval * 20; | ||
intervalId = setInterval(() => { | ||
elementIds.forEach((elementId) => { | ||
const element = document.querySelector(`#${elementIdPrefix}-${elementId}`); | ||
if (element) { | ||
element.parentNode.removeChild(element); | ||
targetElement.appendChild(element); | ||
elementIds = elementIds.filter((id) => id !== elementId); | ||
} | ||
else { | ||
console.warn(`Element with Id: ${elementId} not found yet.`); | ||
} | ||
}); | ||
if (elementIds.length < 1 || intervalLimit <= 0) { | ||
clearInterval(intervalId); | ||
} | ||
intervalLimit -= updateInterval; | ||
}, updateInterval); | ||
} | ||
export { relocateLivingDocsElements }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./Service"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Note: Export all your code in here, that should be exposed to the consumer | ||
// e.g. Exports all exports of the Service.ts file | ||
export * from "./Service"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |