add store option function 'defulat'

This commit is contained in:
세젤귀 고양이들 2021-12-24 19:07:09 +09:00
parent f0c27bc4c6
commit 92a639df71
2 changed files with 4 additions and 1 deletions

View file

@ -34,13 +34,13 @@ local _,advancedTween = pcall(require,"src.libs.AdvancedTween"); ---@module src.
function module.init() function module.init()
local this = {items = {}}; local this = {items = {}};
this.require = require;
this.advancedTween = type(advancedTween) == "table" and advancedTween; this.advancedTween = type(advancedTween) == "table" and advancedTween;
this.event = event.init(this); this.event = event.init(this);
this.store = store.init(this); this.store = store.init(this);
--this.style = style.init(this); --this.style = style.init(this);
this.class = class.init(this); this.class = class.init(this);
this.mount = mount.init(this); this.mount = mount.init(this);
this.require = require;
--this.makeClass = makeClass; --this.makeClass = makeClass;
--this.tween = tween; --this.tween = tween;

View file

@ -136,6 +136,9 @@ function module.init(shared)
end end
return register; return register;
end end
function store:default(key,value)
self[key] = self[key] or value;
end
function new.new(self) function new.new(self)
return setmetatable( return setmetatable(
{__self = self or {},__evt = setmetatable({},week),__reg = setmetatable({},week)},store {__self = self or {},__evt = setmetatable({},week),__reg = setmetatable({},week)},store