Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance 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%

AltStyle によって変換されたページ (->オリジナル) /