Sections: Status -> Approved
Installation - Install a New Entity™
1.) cleanValue - I/O value formatting
2.) createOrigin - Define Origin locations and base environment variables
3.) entityMap - Define Maps to discoverable metaclass objects.
4.) interactionsXY - XY Interaction building blocks
5.) newentity - Optimized Response Code
6.) presentEntity - Define Entity display definitions
7.) tempoCommunicate - Time logic-engine and server communication decider
8.) windowView - Define View logic and add enhanced visual features
9.) index - Default Starting Page
10.) sitemap - Default Base Page
11.) /textpage/plain Default Base Page
Extensions: Extend your New Entity™
Source Code: tempoCommunicate.js
Purpose: Talk to the prototype Time-server which can be used to publicly declare instance availability or revoke it. Generate time-driven outputs.
Additional Usage: Extend time-driven functions and establish automative routines.
// Copyright (C) 2020 New Entity Operations Inc.
// All Rights Reserved
// tempoCommunicate.js
// https://NewEntity.io/section/7/
// tempoCommunicate.js
// Version 0.4 (12/24/2020)
let counterTimeNow = 0;
function makeRequestPOST (objectRequestPOST) {
let oXMLHR = new XMLHttpRequest();
oXMLHR.open("POST", urlFullPathContact, 1);
oXMLHR.setRequestHeader('Content-Type', 'application/json');
oXMLHR.send();
}
function makeMockRequestPOST (objectRequestPOST) {
let oXMLHR = new XMLHttpRequest();
oXMLHR.open("POST", urlFullPathMock, 1);
oXMLHR.setRequestHeader('Content-Type', 'application/json');
oXMLHR.send();
}
function formatVariableTime (spentTime=counterTimeNow) {
// You can tie this into a custom POST hook when needed
// console.log("Spent "+spentTime+" seconds on page "+pageCurrent);
// Public Data Definitions: GDPR and CCPA compliant Ad Network
metricEngagement = spentTime;
let objectRequestPOST = {
"Engagement": metricEngagement,
}
makeMockRequestPOST(objectRequestPOST);
// console.log(spentTime+" added.");
}
function tallyTime() {
counterTimeNow++;
// console.log(counterTimeNow);
}
function stateStart () {
var trackerInterval = window.setInterval(tallyTime, 1000);
// To branch states, begin here.
//clearInterval(trackerInterval);
//console.log("Interval: Ended");
}
function formatTimeEnd () {
var timeEnd = 0; //
}
function alterWindowObject () {
// Add each object here that is state focused, such as loaders or off-site linkers
var alterWindowX = 0;
}
function makeRequestGET (active, objectRequestGET) {
// None given by default
if (active=0) {
// console.log("No activity happens between any other host nodes.");
} else if (active=1) {
// GET call code here
// Use your own method or use the default
// console.log("Resync: "+COREHOST);
// console.log("This site is PUBLIC and set to receive communications on endpoint "+sockINOUT+" serving the pages defined in "+locationSiteMap+" for the DOMAIN: "+originPoint);
} else {
// console.log("No host or networked communication routines identified.");
}
}
let objectRequestGET = {
// GET the 'tempo' object
"CURRENTSITEMAP": locationSiteMap,
"DOMAIN": originPoint,
"LOCATIONCOMM": sockINOUT
}
// See 'Legacy Factors: Section 8' for more details about what a 'legacy factor' will be
function runTempoRoutine (legacy, mode) {
stateStart();
if (legacy == 0) {
// console.log("Not supporting legacy factors.");
} else if (legacy == 1) {
// console.log("Supporting legacy factors.");
} else {
// console.log("Legacy state was unable to be determined.");
}
if (mode == 0) {
// console.log("This entity is not communicating with CORE.HOST");
} else if (mode == 1) {
makeRequestGET(objectRequestGET);
// console.log("This entity is communicating with CORE.HOST");
} else {
// console.log("Invalid mode: Falling back to OUTLINK: 0")
}
}
function destroyTempoRoutine() {
formatVariableTime(counterTimeNow);
}
if (MAINTENANCE==1) {
location.replace("/about/");
} else {
// Actions Center
// Perform action and consider various legacy scenarios
if (document.addEventListener, legacy=ON, mode=OUTLINK) {
// Active runner, extend as needed
document.addEventListener("DOMContentLoaded", () => {
runTempoRoutine(legacy, mode);
});
window.addEventListener("unload", () => {
destroyTempoRoutine();
});
} else if (document.attachEvent, legacy=ON) {
// Branch browsers here as neededo
console.log("Try a newer browser, site function and loading will work better!");
document.attachEvent("DOMContentLoaded", runTempoRoutine);
document.attachEvent("unload", destroyTempoRoutine);
}
}