HTML5 Web Component & Vanilla JavaScript All In One
HTML5 Web Component & Vanilla JavaScript All In One
https://www.webcomponents.org/polyfills
https://github.com/WebComponents/webcomponentsjs
https://www.codementor.io/ayushgupta/vanilla-js-web-components-chguq8goz
https://ayushgp.github.io/html-web-components-using-vanilla-js-part-2/
web-components
https://developers.google.com/web/fundamentals/web-components/
https://developers.google.com/web/fundamentals/web-components/examples/howto-checkbox
https://googlechromelabs.github.io/howto-components/howto-checkbox/#demo
https://developers.google.com/web/fundamentals/web-components/examples/howto-tabs
https://googlechromelabs.github.io/howto-components/howto-tabs/#demo
https://developers.google.com/web/fundamentals/web-components/examples/howto-tooltip
https://googlechromelabs.github.io/howto-components/howto-tooltip/#demo
https://github.com/GoogleChromeLabs/howto-components
Pub/Sub pattern & JavaScript
https://gist.github.com/learncodeacademy/777349747d8382bfb722
http://github.com/learncodeacademy
https://github.com/learncodeacademy/react-js-tutorials
https://www.youtube.com/learncodeacademy/
Pub/Sub JavaScript Object
https://davidwalsh.name/pubsub-javascript
https://github.com/darkwing
https://github.com/darkwing/LazyLoad
publish/subscribe pattern
https://addyosmani.com/blog/understanding-the-publishsubscribe-pattern-for-greater-javascript-scalability/
https://msdn.microsoft.com/en-us/magazine/hh201955.aspx
https://github.com/addyosmani
https://medium.com/dev-channel/the-cost-of-javascript-84009f51e99e
Event Type Checker
// utils
/**
* @author xgqfrms 2018.05.28
* @description show Event Type
* @param {String} event
*/
const showEventType = (event) => {
let stringType = Object.prototype.toString.call(event),
type = "";
switch (stringType) {
case "[object Function]":
type = "Function";
break;
case "[object Object]":
type = "Object";
break;
case "[object Array]":
type = "Array";
break;
case "[object Number]":
type = "Number";
break;
case "[object Boolean]":
type = "Boolean";
break;
case "[object Symbol]":
type = "Symbol";
break;
case "[object String]":
type = "String";
break;
default:
// "[object Undefined]"
// type = `${stringType}`;
type = undefined;
break;
}
return type;
};
/**
* @author xgqfrms 2018.05.28
* @description show Typeof
* @param {String} event
*/
const showTypeof = (event) => {
let stringType = typeof (event),
type = "";
switch (stringType) {
case "function":
type = "Function";
break;
case "object":
if (Array.isArray(event)) {
type = "Array";
} else {
type = "Object";
}
break;
case "number":
type = "Number";
break;
case "boolean":
type = "Boolean";
break;
case "symbol":
type = "Symbol";
break;
case "string":
type = "String";
break;
default:
// "undefined"
// type = `${stringType}`;
type = undefined;
break;
}
return type;
};
arguments
function test(a, b, c) {
let args = Array.prototype.slice.call(arguments, 1);
// 1
console.log("(arguments =\n", arguments);
console.log("shaped args =\n", args );
}
test({}, [], "str");
function new_test(a, b, c) {
let args = Array.prototype.slice.call(arguments, 0);
// 0
console.log("(arguments =\n", arguments);
console.log("shaped args =\n", args );
}
new_test({}, [], "str");
polymer
https://www.polymer-project.org
https://www.polymer-project.org/3.0/docs/about_30
<!DOCTYPE html>
<html lang="en">
<head>
<script src="./node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
<script src="./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
</head>
<body>
<likeable-element></likeable-element>
</body>
</html>
import './likeable-element.js';
// Import an element
import '@polymer/paper-checkbox/paper-checkbox.js';
// Import the PolymerElement base class and html helper
import {PolymerElement, html} from '@polymer/polymer';
// Define an element class
class LikeableElement extends PolymerElement {
// Define publc API properties
static get properties() { return { liked: Boolean }}
// Define the element's template
static get template() {
return html`
<style>
.response { margin-top: 10px; }
</style>
<paper-checkbox checked="{{liked}}">I like web components.</paper-checkbox>
<div hidden$="[[!liked]]" class="response">Web components like you, too.</div>
`;
}
}
// Register the element with the browser
customElements.define('likeable-element', LikeableElement);
refs
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/9089545.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
2016-05-25 正则表达式: javascript Unicode 中文字符 编码区间:\u4e00-\u9fa5