本文整理汇总了TypeScript中@akala/server.injectWithName函数的典型用法代码示例。如果您正苦于以下问题:TypeScript injectWithName函数的具体用法?TypeScript injectWithName怎么用?TypeScript injectWithName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了injectWithName函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
akala.injectWithName(['$isModule', '$master', '$worker'], function (isModule: akala.worker.IsModule, master: akala.worker.MasterRegistration, worker: EventEmitter)
{
if (isModule('@domojs/lifttt'))
{
worker.on('ready', function ()
{
// Called when all modules have been initialized
});
worker.on('after-master', function ()
{
// Called when all modules have been initialized
require('./services/console');
require('./services/fs');
require('./services/http');
require('./api');
});
master(__filename, './master');
akala.injectWithName([AssetRegistration.name], function (virtualasset: PromiseLike<AssetRegistration>)
{
virtualasset.then((va) =>
{
va.register('/js/tiles.js', require.resolve('../tile'));
va.register('/js/routes.js', require.resolve('../routes'));
});
})();
}
})()
开发者ID:domojs,项目名称:lifttt,代码行数:32,代码来源:index.ts
示例2: function
akala.worker.createClient('devices').then(function (c)
{
var deviceCollection: { [name: string]: devices.devices.IDevice } = {};
akala.injectWithName(['$worker'], function (worker)
{
function getMainDevice(name)
{
var indexOfDot = name.indexOf('.');
if (indexOfDot > 0)
var mainDevice = name.substr(0, indexOfDot);
else
var mainDevice = name;
return deviceCollection[mainDevice];
}
var client = akala.api.jsonrpcws(devices.deviceType).createClient(c, {
exec: function (p)
{
var cmd = p.command;
var mainDevice = getMainDevice(p.device);
if (p.device != mainDevice.name)
{
switch (p.device.substring(mainDevice.name.length + 1))
{
case 'power':
if (p.command == 'off')
cmd = 'PF'
else
cmd = 'PO'
break;
case 'mute':
if (p.command == 'off')
cmd = 'MF';
else
cmd = 'MO';
break;
case 'volume':
switch (p.command)
{
case 'up':
cmd = 'VU';
break;
case 'down':
cmd = 'VD';
break;
case 'set':
cmd = 'VL';
break;
}
break;
case 'input':
switch (p.command)
{
case 'Game':
cmd = '49FN';
break;
case 'Dvd':
cmd = '04FN';
break;
case 'Sat/Cbl':
cmd = '06FN';
break;
case 'Dvr/Bdr':
cmd = '15FN';
break;
case 'iPod':
cmd = '17FN';
break;
case 'Video':
cmd = '10FN';
break;
case 'BD':
cmd = '25FN';
break;
}
break;
}
}
return api.send(cmd, mainDevice['address']).then((result) => undefined);
},
getStatus: function (device)
{
var mainDevice = getMainDevice(device.device);
if (mainDevice.name == device.device)
return Promise.resolve(mainDevice.status());
else
return Promise.resolve(mainDevice.subdevices[device.device.substring(mainDevice.name.length + 1)].status());
},
save: (p) =>
{
if (p.device.name.indexOf('.') > -1)
return p.device;
deviceCollection[p.device.name] = p.device;
p.device['address'] = p.body.IP || p.device.name;
p.device.statusMethod = 'pull';
p.device.subdevices = [
{
name: "power",
//.........这里部分代码省略.........
开发者ID:domojs,项目名称:domojs-pioneer,代码行数:101,代码来源:index.ts
示例3: function
import * as akala from '@akala/server';
import { EventEmitter } from 'events';
akala.injectWithName(['$isModule'], function (isModule: akala.worker.IsModule)
{
if (isModule('@domojs/media-kodi'))
{
require('./player');
require('./scrapper');
}
})();
开发者ID:domojs,项目名称:domojs-media-kodi,代码行数:11,代码来源:index.ts
注:本文中的@akala/server.injectWithName函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论