Category : ecmascript-6

I want to use ServiceWorker of javascript to cache an HTML file for offline view. But problem is I have a django application. and I don’t know how can I specify my template files in service-worker.js. I specified a URL for service-worker.js in my urls.py like this – path(‘service-worker.js’, (TemplateView.as_view(template_name="menu/service-worker.js", content_type=’application/javascript’, )), name=’service-worker.js’) this is ..

Read more

I try to run ECMAScript 6 with python I already try that from quickjs import Function from py_mini_racer import py_mini_racer import execjs import js2py import requests_html js = """ function test(){ document.write(` """+html+"""`); return document.documentElement?.innerHTML } //test() """ result = js2py.eval_js(js) print(result) TemplateElement is not supported by ECMA 5.1. Source: Python..

Read more