├── .gitignore ├── .npmrc ├── Gruntfile.js ├── package.json ├── index.html └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .grunt/ 3 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | registry= http://registry.npmjs.org/ 2 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | /*global module:false*/ 2 | module.exports = function (grunt) { 3 | grunt.initConfig({ 4 | 5 | 'gh-pages': { 6 | options: { 7 | base: '.' 8 | }, 9 | src: [ 10 | 'README.md', 11 | 'angular-web-worker.js', 12 | 'angular-web-worker-1.4.7.js', 13 | 'index.html', 14 | 'node_modules/console-log-div/console-log-div.js' 15 | ] 16 | } 17 | }); 18 | 19 | var plugins = module.require('matchdep').filterDev('grunt-*'); 20 | plugins.forEach(grunt.loadNpmTasks); 21 | }; 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-in-web-worker", 3 | "version": "1.0.0", 4 | "description": "Running AngularJS 1.x in web worker", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "deploy": "grunt gh-pages" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/bahmutov/angular-in-web-worker.git" 13 | }, 14 | "keywords": [ 15 | "angular", 16 | "angularjs", 17 | "browser", 18 | "web", 19 | "worker", 20 | "experiment", 21 | "demo" 22 | ], 23 | "author": "Gleb Bahmutov ", 24 | "license": "MIT", 25 | "bugs": { 26 | "url": "https://github.com/bahmutov/angular-in-web-worker/issues" 27 | }, 28 | "homepage": "https://github.com/bahmutov/angular-in-web-worker", 29 | "dependencies": { 30 | "console-log-div": "0.5.0" 31 | }, 32 | "devDependencies": { 33 | "grunt": "0.4.5", 34 | "grunt-gh-pages": "0.10.0", 35 | "matchdep": "0.3.0" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Angular 1.x in Web Worker

9 |

loads angular in a web worker. The loaded angular will run a digest cycle after 1 second 10 | and will send rendered HTML to the main browser window (here). To run, load the index.html 11 | using a local webserver, for example http-server.

12 |
rendered HTML from web worker will replace this text.
13 | 14 | 15 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # angular-in-web-worker 2 | 3 | > Running AngularJS 1.x in Web Worker 4 | 5 | [Demo](http://glebbahmutov.com/angular-in-web-worker/) 6 | 7 | To run: run local static http server in this folder, for example 8 | [http-server](https://www.npmjs.com/package/http-server), like `http-server -p 3040` 9 | then open [localhost:3040](http://localhost:3040/). The page should show a text message 10 | and then rendered HTML code computed and sent by the AngularJS application running in the web worker. 11 | 12 | Read [Run Angular in Web Worker](http://glebbahmutov.com/blog/run-angular-in-web-worker/). 13 | 14 | The Angular web worker bundle was created using 15 | [bahmutov/bundle-angular-for-web-worker](https://github.com/bahmutov/bundle-angular-for-web-worker) 16 | 17 | ### Small print 18 | 19 | Author: Gleb Bahmutov © 2015 20 | 21 | * [@bahmutov](https://twitter.com/bahmutov) 22 | * [glebbahmutov.com](http://glebbahmutov.com) 23 | * [blog](http://glebbahmutov.com/blog) 24 | 25 | License: MIT - do anything with the code, but don't blame me if it does not work. 26 | 27 | Spread the word: tweet, star on github, etc. 28 | 29 | Support: if you find any problems with this module, email / tweet / 30 | [open issue](https://github.com/bahmutov/angular-in-web-worker/issues) on Github 31 | 32 | ## MIT License 33 | 34 | Copyright (c) 2015 Gleb Bahmutov 35 | 36 | Permission is hereby granted, free of charge, to any person 37 | obtaining a copy of this software and associated documentation 38 | files (the "Software"), to deal in the Software without 39 | restriction, including without limitation the rights to use, 40 | copy, modify, merge, publish, distribute, sublicense, and/or sell 41 | copies of the Software, and to permit persons to whom the 42 | Software is furnished to do so, subject to the following 43 | conditions: 44 | 45 | The above copyright notice and this permission notice shall be 46 | included in all copies or substantial portions of the Software. 47 | 48 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 49 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 50 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 51 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 52 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 53 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 54 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 55 | OTHER DEALINGS IN THE SOFTWARE. 56 | --------------------------------------------------------------------------------