Skip to content

Instantly share code, notes, and snippets.

View jasontwuk's full-sized avatar

Jason Liao jasontwuk

View GitHub Profile
@jasontwuk
jasontwuk / libraryWithDependencySystem.js
Created June 17, 2019 06:46
Watch and Code - Beasts 4. librarySystem with dependencies
(function(){
// build a storage for libraries
var libraryStorage = {};
function librarySystem(libraryName, dependencyArray, callback){
// when has dependencyArray and callback
if(arguments.length > 1){
// when has dependency
if(dependencyArray.length > 0){
// save the content of dependency in an array
@jasontwuk
jasontwuk / runWithDebugger.js
Created June 15, 2019 16:14
Watch and Code - Beasts 2. Improving runWithDebugger
function runWithDebugger(callback, array){
debugger;
// when has second argument
if(arguments.length > 1){
// when second argument's type is array
if(Array.isArray(array)){
callback.apply(null, array);
// when second argument's type is not array