Jump to content

FuncJS

From Wikipedia, the free encyclopedia
FuncJS
Original author(s)Sharikul Islam
Developer(s)Sharikul Islam
Initial releaseNovember 1, 2012 (2012-11-01)
Stable release
1 / February 2013 (2013-02)
Written inJavaScript
Size4.84 KB zipped / 10.4 KB (uncompressed)
TypeJavaScript library
LicenseOpen-source
Websitefuncjs.webege.com

FuncJS is an open-source functions only JavaScript library that aims to speed up web development time in the JavaScript programming language by providing 22 pre-written functions made available throughout both releases. FuncJS is intended to allow JavaScript programmers to get the basic areas completed quickly, and let them focus on more larger, code-centric areas of development. As of November 2012, FuncJS is a relatively new product and is in version one of its stable release.

Functions

[edit]

In January 2013, FuncJS 2 was released which got rid of many functions, and renamed some functions. However, the new files were uploaded onto GitHub, but it's a temporary action, as according to the repository's README file. Here's the new list, as according to the new documentation:

  • echo()
  • function_exists()
  • strlen()
  • strpos()
  • str_replace()
  • up()
  • down()
  • store()
  • str_rev()
  • grab()
  • trim()
  • count()
  • strip_tags()
  • show_tags()

Importing FuncJS to webpages

[edit]

FuncJS is available in two versions; minified (compressed) and an uncompressed version,[1] both of which are to be used separately from each other. Similar to other JavaScript libraries, FuncJS can be imported onto a webpage by including it via the "script" HTML tag:

<script src="http://funcjs.webege.com/funcJS-min.js"></script>

According to the documentation, users should make sure FuncJS is loaded and working properly on their webpages by checking whether the browser recognises the FuncJS object:

if (window.funcJS) {
  alert("I'm working!");
} else {
  alert("I'm not working!");
}

Both versions of FuncJS are hosted by FuncJS itself, as demo's suggest that FuncJS is only available through their servers. However, although FuncJS allows users to download a local copy of the file to their own machines, it deeply encourages that users import FuncJS into their webpages through linking it via a URL as "this ensures that you (the user) have any new updates to the file made available to you."

Using FuncJS in webpages

[edit]

Since function's from FuncJS are seen by the browser as regular functions, they would have to be written within "script" tags and would be checked and executed by the browser's JavaScript engine (such as Google Chrome's V8 JavaScript Engine). As seen by the documentation's, function's from FuncJS are designed to fit into normal JavaScript code, therefore not breaking the "flow" of writing JavaScript code. Take this example (from the documentation website[2]):

if (3 < 4) {
  echo("That's correct!");
} else {
  echo("What?!!!");
}

which checks a given condition, and displays text depending on the outcome. As seen by the example, the "echo" function can be considered as a part of JavaScript, similar to PHP.

References

[edit]
  1. ^ "Get Started". Retrieved 2012-11-12.
  2. ^ "echo()". Retrieved 2012-11-11.