vegana
Version:
vegana is a container based js framework
82 lines (63 loc) • 2.88 kB
JavaScript
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
//controllers
const log = false; //set this const to true to log common tell inputs
const type = 'cont';
const contRef = '-cont-time';
const pageName = 'docsPage';
const contName = 'timeCont';
//cont ids
let parentId,contId;
//any parent data can be imported in init function vars
const init = (pid) => { //pid = parent id(parent = page)
if(pid == null || pid == undefined){
return engine.common.error('parent_page_id_not_found'); //check for prent page id
}
engine.common.tell('cont initiated',log); //common tell logger can be closed if global const log be set to false
parentId = pid; //parent id is used to route
contId = parentId + contRef; //contid is used by child doms
engine.make.init.cont(contId,parentId,"cont"); //initiate cont in router before building dom
build(); //start dom build here
}
//these trackers will be triggered when this module is routed
const trackers = {
title:'sample cont title',
meta:[
{
name:'description',
content:'this is a sample cont description'
},
{
name:'keywords',
content:'cont,vegana'
}
],
function_data:{},
//function will be triggered with the function data as input when the module is routed to.
function:(function_data)=>{}
};
//build the cont dom here
function build(){
engine.common.tell('building',log);
//sample greetings
let greetings = engine.make.div({
id:"greetings",
parent:contId,
class:'greetings',
text:'greetings this is the time cont'
});
//import panels when required to build required objects faster
return true; //always return
}
//do not change current exports you are free to add your own though.
const contControllers = {
init:init,
ref:contRef,
type:type,
contName:contName,
panelModules:{}, //dont fill this object, imported panels are loaded automatically.
panelList:{},
trackers:trackers
};
module.exports = contControllers;
window.pageModules[pageName].contModules[contName] = contControllers;
},{}]},{},[1]);