Skip to content

javascript plugin allows to execute any function of javascript code in a thread

License

Notifications You must be signed in to change notification settings

Saltallica/vkthread

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##vkThread javascript plugin, which allows you to execute a function in a separate thread.

Function can be defined directly in the main thread or called from an external javascript file.

Function can be:

  • Regular functions
  • Object's methods
  • Functions with dependencies
  • Functions with context
  • Anonymous functions

Plugin is built on HTML5 "Web Worker" technology. (old version of the plugin can be found under tag 0.5.7)

  • file size: 3.5k minified / 5.5k development
  • Doesn't have any dependecies.

Basic usage:

  • install with bower
bower install vkthread
  • integrate plugun in your project:
<script src="../vkthread/vkthread.min.js" type="text/javascript"></script>
  • create function
/* function to execute in a thread */
function foo(n, m){
	return n + m;
}
  • execute this function in a thread
/* create an object, which you pass to vkThread as an argument*/
var param = {
      fn: foo      // <-- function to execute
      args: [1, 2] // <-- arguments for this function
    };

/* run thread */
vkThread.exec(param).then(
   function (data) {
       console.log(data);  // <-- thread returns 3
    },
    function(err) {
        alert(err);  // <-- thread returns error message
    }

);

######Documentation & Examples: ( http://www.eslinstructor.net/vkthread/ )

About

javascript plugin allows to execute any function of javascript code in a thread

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 43.6%
  • JavaScript 41.6%
  • CSS 14.7%
  • PHP 0.1%