bottlejs icon indicating copy to clipboard operation
bottlejs copied to clipboard

Missing documentation regarding lazy-loading functionality

Open noherczeg opened this issue 6 years ago • 1 comments

At the top of the docs it mentions lazy-loading, but I can't find anything in the docs regarding where and how is this available.

Sample use-cases would be nice as well :-)

noherczeg avatar Aug 31 '18 14:08 noherczeg

It lazy loads by default; there's no way to disable it.

let count = 0;
bottle.factory('SoLazy', container => {
    count++;
    return {};
});
console.log(count); // 0
bottle.container.SoLazy;
console.log(count); // 1

I guess it would make sense for me to spell that out in the readme; thanks for the suggestion!

young-steveo avatar Aug 31 '18 15:08 young-steveo