Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,161,641 members, 7,847,673 topics. Date: Sunday, 02 June 2024 at 12:15 AM

New Bucketjs Library For Javascript Released - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / New Bucketjs Library For Javascript Released (445 Views)

Havohej Library For Bloggers, Vloggers, Webmaster!!! / Get Paid Writing HTML And Javascript Codes Only (2) (3) (4)

(1) (Reply) (Go Down)

New Bucketjs Library For Javascript Released by heywhy824(m): 2:19pm On Aug 25, 2016
I' m happy to release the first version of BucketJS project which was built with my little knowledge of JavaScript. I will appreciate and be more happy if you guys can help review it. Critics is allowed for that's what keeps us on our toes.
You can download using composer require heywhy/bucketjs or download through github https://github.com/heywhy/BucketJS thanks.
Re: New Bucketjs Library For Javascript Released by SeunLanLege(m): 2:55pm On Aug 25, 2016
heywhy824:
I' m happy to release the first version of BucketJS project which was built with my little knowledge of JavaScript. I will appreciate and be more happy if you guys can help review it. Critics is allowed for that's what keeps us on our toes.
You can download using composer require heywhy/bucketjs or download through github https://github.com/heywhy/BucketJS/archive/master.zip. thanks.

What does it do?
Re: New Bucketjs Library For Javascript Released by heywhy824(m): 3:27pm On Aug 25, 2016
SeunLanLege:
What does it do?
It helps prevent pollution of of the global scope [object window] and helps you from always typing the new keyword. You can give it a try, I will love to have a feedback from you. And thanks for the time that will spent reviewing it.
Re: New Bucketjs Library For Javascript Released by heywhy824(m): 8:46pm On Aug 25, 2016
Waiting for reviews...
Re: New Bucketjs Library For Javascript Released by heywhy824(m): 3:40pm On Sep 03, 2016
I'm happy to release the first official release of the BucketJS library version 0.1.0.
The aim of the library is to implement namespacing system which is present in languages like c++, php and so on. I hope you guys can help embrace it and improving.
Because having a class or context per file makes you more organized and its always easy to amend errors since you know the class having fault, you just go straight to file to fix it.

I will be more happy if you all can embrace the concept. behind the library. I will like you all to give your comments for that's what help in improving the library.


# BucketJS Library
* it tries to help you make your codes well organised i.e. a class per file
...* var control = Bucket('App/Core/Controller') matches app/core/controller.js file in the base directory.
...* Bucket(['App/Game'], function(){
this.init = function(){
console.log('game started');
}
}); // matches www/app/game.js
...* you will find some examples below
* trying to implement Namespacing in the other languages
* Include the src/Bucket.js file in your page and you are set to use it.
* The dist directory consists of the different aspects implemented into the library

it is very simple to use
/**
* the files are fetched from a default folder App e.g. www/app, www/js/app
* you can also set the base directory where the app folder is
* e.g. Bucket({fetch: true, base: js/app/});
* it will fetch the files from www/js/app directory
*/

// to define a class, the classname must match the path to the file
// file: www/app/core/hello.js
Bucket(['App/Core/Hello'], function(){
this.call = function(){
alert('hello world');
}
});

// file: www/index.html including the library
// to get the instantiated copy
var hello = Bucket('App/Core/Hello');
hello.call(); // 'hello world'

/**
* defining a class with dependencies to other classes
* a class can have as many dependencies as possible but they will all
* be passed as parameters in the order they were declared to the class depending on them.
* if a dependency depends on another class they all get passed for the library
* is smart enough to sort that.
*/
// file: www/app/core/welcome.js

Bucket(['App/Core/Welcome', ['App/Core/Hello', 'App/Core/Bye']], function(hello, bye){
// the hello param will be an object of App\Core\Hello::class
this.welcome = function(){
hello.call();
}

this.bye = function(){
bye.bye();
}
});

// file; www/app/core/bye.js
Bucket(['App/Core/Bye'], function(){
this.bye = function(){
alert('Thank you for trying me out. Courtesy: BucketJS');
}
});

// file: www/index.html including the library
// to get the instantiated copy
var app = Bucket('App/Core/Welcome');
app.welcome(); // => 'hello world'
app.bye() // => 'Thank you for trying me out. Courtesy: BucketJS'

composer: require heywhy/bucketjs
github link:
https//github.com/heywhy/BucketJS


when defining a class if 'App' is not part of the definition it assumes that the namespace is a subpath in tbe app directory. e.g
Bucket(['Core/Hello'], function(){
this.call = function(){
alert('hello');
}
});

defaults to App/Core/Hello.js, if 'App' was included it is omitted before requiring the file;

if a file has been require before it gets cached, while subsequent calls to file will be fetched from the cache instead of requesting it from the server, which can be an overkill.

(1) (Reply)

Website For Sale With Premuim Domain / Join The Group To Get Fully Approved Adsense / Blog / How To Make Social Share Button Jumbreak Below Every Post On Your Blog

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 23
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.