pimatic-mjpg
Version:
pimatic plugin to show mjpg stream
31 lines (24 loc) • 912 B
text/coffeescript
module.exports = (env) ->
Promise = env.require 'bluebird'
assert = env.require 'cassert'
class MjpgPlugin extends env.plugins.Plugin
init: (app, , ) =>
deviceConfigDef = require("./device-config-schema.coffee")
.deviceManager.registerDeviceClass("MjpgDevice",{
configDef : deviceConfigDef.MjpgDevice,
createCallback : (config) => new MjpgDevice(config)
})
.on "after init", =>
mobileFrontend = .pluginManager.getPlugin 'mobile-frontend'
if mobileFrontend?
mobileFrontend.registerAssetFile 'js', "pimatic-mjpg/app/MjpgTempl-page.coffee"
mobileFrontend.registerAssetFile 'html', "pimatic-mjpg/app/MjpgTempl-template.html"
class MjpgDevice extends env.devices.Device
template: 'mjpg'
constructor: () ->
= .id
= .name
super()
destroy: ->
super
return new MjpgPlugin()