Skip to content

Instantly share code, notes, and snippets.

Avatar

유동식 dongsik-yoo

View GitHub Profile
@dongsik-yoo
dongsik-yoo / example.js
Created Oct 15, 2020
Intl.DateTimeFormat example
View example.js
const date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
const options = {
timeZone: 'America/Los_Angeles',
timeStyle: 'long'
};
console.log(new Intl.DateTimeFormat('ko-KR', options).format(date));
// 오후 7시 0분 0초 GMT-8
View webpack.output.config.js
output: {
library: ['tui', 'Calendar'], // Configuring the library namespace
libraryTarget: 'umd', // Configuring the library target
libraryExport: 'default', // Configuring the default export of the entry point to the namespace
...
}
View package.json
{
"scripts": {
"doc": "tuidoc"
}
}
View shaked.bundle.js
new (class extends v {
getComponent() {
return Object(o.h)("h2", null, "Week View");
}
})(document.getElementById("app1")).render();
View shaked.test.js
import { Month, Week } from "esm-ui-library";
const week = new Week(document.getElementById("app1"));
week.render();
// const month = new Month(document.getElementById("app2"));
// month.render();
// document.getElementById("ssr").innerHTML = month.renderToString();
View bundle.js
new (class extends v {
getComponent() {
return Object(o.h)("h2", null, "Week View");
}
})(document.getElementById("app1")).render();
const m = new (class extends v {
getComponent() {
return Object(o.h)("h2", null, "Month View");
}
})(document.getElementById("app2"));
View test.js
import { Month, Week } from "esm-ui-library";
const week = new Week(document.getElementById("app1"));
week.render();
const month = new Month(document.getElementById("app2"));
month.render();
document.getElementById("ssr").innerHTML = month.renderToString();
View week.tsx
import { h } from 'preact';
import Base from '@src/base';
export default class Week extends Base {
protected getComponent(): JSX.Element {
return <h2>Week View</h2>;
}
}
View month.tsx
import { h } from 'preact';
import Base from '@src/base';
export default class Month extends Base {
protected getComponent(): JSX.Element {
return <h2>Month View</h2>;
}
}
View base.ts
import { render, ComponentChild } from 'preact';
import renderToString from 'preact-render-to-string';
export default abstract class Base {
private _container: Element;
private _base?: Element;
public constructor(container: Element) {
this._container = container;
You can’t perform that action at this time.