UNPKG
@sinotron/core
Version:
latest (0.0.7-alpha)
0.0.7-alpha
0.0.6-alpha
0.0.4-alpha
0.0.2-alpha
0.0.1-alpha
Simple framework for Typescript Electron projects
@sinotron/core
/
dist
/
lib
/
instantiate.js
15 lines
(14 loc)
•
312 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const
container =
new
Map(); export
const
Instance = {
get
(c, ...
args
) {
return
new
c(...
args
); }, singleton(c, ...
args
) {
let
inst = container.
get
(c);
if
(!inst) { inst =
new
c(...
args
); container.
set
(c, inst); }
return
inst; } };