Debian Codegraph @

src/pyj/worker.pyj

raw
1 # vim:fileencoding=utf-8
2 # License: GPL v3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
3 from __python__ import bound_methods, hash_literals
4
5 from book_list.globals import main_js
6
7
8 def worker_js_url(entry_point):
9 if not worker_js_url.ans:
10 worker_js_url.ans = window.URL.createObjectURL(Blob([main_js()]), {'type': 'text/javascript'})
11 return worker_js_url.ans + '#' + entry_point
12
13
14 def start_worker(entry_point):
15 return new window.Worker(worker_js_url(entry_point))