ccmjs / ccm Goto Github PK
View Code? Open in Web Editor NEWCore script of the ccmjs web technology.
License: MIT License
Core script of the ccmjs web technology.
License: MIT License
In my component, the cc-loading indicator is visible all the time. This is my code:
(() => {
const component = {
name: 'counter-kh',
ccm: 'https://ccmjs.github.io/ccm/ccm.js',
config: {
css: ['ccm.load', '']
},
Instance: function () {
let clicks = 0;
let count = 0;
const countDisplay = document.createElement('p');
const clicksDisplay = document.createElement('p');
const incrementButton = document.createElement('button');
const decrementButton = document.createElement('button');
incrementButton.innerText = '+';
decrementButton.innerText = '-';
incrementButton.onclick = () => {clicks++; count++; this.update();};
decrementButton.onclick = () => {clicks++; count--; this.update();};
this.update = () => {
countDisplay.innerText = `count: ${count}`;
clicksDisplay.innerText = `clicks: ${clicks}`;
};
this.start = async () => {
this.update();
this.element.appendChild(countDisplay);
this.element.appendChild(clicksDisplay);
this.element.appendChild(incrementButton);
this.element.appendChild(decrementButton);
};
}
};
let b = "ccm." + component.name + (component.version ? "-" + component.version.join(".") : "") + ".js"; if (window.ccm && null === window.ccm.files[b]) return window.ccm.files[b] = component; (b = window.ccm && window.ccm.components[component.name]) && b.ccm && (component.ccm = b.ccm); "string" === typeof component.ccm && (component.ccm = { url: component.ccm }); let c = (component.ccm.url.match(/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)/) || ["latest"])[0]; if (window.ccm && window.ccm[c]) window.ccm[c].component(component); else { var a = document.createElement("script"); document.head.appendChild(a); component.ccm.integrity && a.setAttribute("integrity", component.ccm.integrity); component.ccm.crossorigin && a.setAttribute("crossorigin", component.ccm.crossorigin); a.onload = function () { window.ccm[c].component(component); document.head.removeChild(a) }; a.src = component.ccm.url }
})();
If you pass an object to ccm
which contains a circular, you get the following error:
ccm.start('myCCMComponent', {attr: objectWithCircular);
ccm-20.0.0.min.js:1 Uncaught (in promise) TypeError: Converting circular structure to JSON
Here is an explanation for this problem: https://stackoverflow.com/questions/11616630/json-stringify-avoid-typeerror-converting-circular-structure-to-json
Should this be fixed within ccm
or before the object is passed to ccm
?
"If loading of at least one resource fails, ccm.load will not return a result and the callback will not be called."
As a developer I want to get a response if the loading of a response failed or not.
Currently the callback has only one parameter "result". Maybe there could be two params result and err where i can check if error is null or not.
Example: https://nodejs.org/api/fs.html#fs_file_paths
It could be useful to have a helper-function like ccm.helper.html
, which transforms and replaces placeholders (recursive) from SVG (from ccm SVG data
, String
, ...) to a SVG Element
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.