Skip to content

Instantly share code, notes, and snippets.

@Narazaka
Created November 28, 2014 02:27
Show Gist options
  • Save Narazaka/45f6bf986c7380bd8d1a to your computer and use it in GitHub Desktop.
Save Narazaka/45f6bf986c7380bd8d1a to your computer and use it in GitHub Desktop.
AYA5Worker.coffee
self.importScripts("encoding.min.js")
self.importScripts("aya5.js")
self.importScripts("nativeshiori.js")
shiori = new AYA5()
shiori.Module.logReadFiles = true
shiorihandler = null
self.onmessage = ({data: {event, data}}) ->
switch event
when "load"
shiorihandler = new NativeShiori(shiori, data, true)
code = shiorihandler.load('/home/web_user')
self.postMessage({event: "loaded", error: null, data: code})
when "request"
request = data
response = shiorihandler.request(request)
self.postMessage({event: "response", error: null, data: response})
when "unload"
code = shiorihandler.unload()
self.postMessage({event: "unloaded", error: null, data: code})
else throw new Error(event + " event not support")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment