- Singleton
- Fluent Interface
- Observer
- Composite
- Abstract factory
https://www.netguru.com/codestories/top-5-most-used-patterns-in-oop-with-typescript
https://www.netguru.com/codestories/top-5-most-used-patterns-in-oop-with-typescript
https://debugpointer.com/check-if-an-object-is-a-promise/
function isPromise(p) {
return p && Object.prototype.toString.call(p) === "[object Promise]";
}
export type Dictionary<T> = { | |
[key: string]: T; | |
}; | |
export class GlobalStore { | |
static get(key: string) { | |
if (getGlobalStore().data === undefined) | |
getGlobalStore().data = {}; | |
if (getGlobalStore().data[key] === undefined) |
import 'reflect-metadata'; | |
import { ReflectiveInjector, Injectable, Injector } from 'injection-js'; | |
class Service { | |
get() { | |
return "my service"; | |
} | |
} | |
class Service2 { |
// Credit | |
// https://www.stevefenton.co.uk/2014/07/creating-typescript-classes-dynamically | |
// https://gist.github.com/mfdeveloper/c337408608d6033fde967fc2e76b12c4 | |
interface ObjectKeyString { | |
[key: string]: any; | |
} | |
class InstanceLoader { |
const winston = require('winston'); | |
const { format } = winston; | |
const formatConsole = format.printf(( { message, level, timestamp }: any ) => { | |
return `${timestamp} ${level}: ${message}`; | |
}); | |
const formatFile = format.printf(( { message, level, timestamp }: any ) => { | |
return JSON.stringify({ message, level, timestamp }); | |
}); |
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://d3js.org/d3.v4.min.js" > </script> | |
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> | |
<style> | |
body { | |
overflow:hidden; |
โปรเจ็คมี 2 ส่วน
Frontend stacks:
Inspire from Publish from Bear to WordPress on iOS's rovest repo
Version 1.0.0 Download