本文整理汇总了TypeScript中edge.func函数的典型用法代码示例。如果您正苦于以下问题:TypeScript func函数的具体用法?TypeScript func怎么用?TypeScript func使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了func函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: func
func<T>(funcName: string): EdgeFunc<T> {
let stored: EdgeFunc<T> = this.functions[funcName];
if (!stored) {
var func = edge.func({
assemblyFile: this.assemblyFile,
typeName: this.typeName,
methodName: funcName
});
stored = arg => {
var defer = q.defer<T>();
func(arg, (err, result) => {
if (err)
defer.reject(err);
else
defer.resolve(result);
});
return defer.promise;
};
this.functions[funcName] = stored;
}
return stored;
}
开发者ID:kedrzu,项目名称:asparagus,代码行数:26,代码来源:EdgeProxy.ts
示例2: describe
describe("EntitySet", () => {
var start = edge.func({
assemblyFile: "bin/debug/Fable.JavaScript.Test.dll",
typeName: "Fable.JavaScript.Test1",
methodName: "Start"
});
var pub = edge.func({
assemblyFile: "bin/debug/Fable.JavaScript.Test.dll",
typeName: "Fable.JavaScript.Test1",
methodName: "Publish"
});
before((done: MochaDone) => {
start(null, (error, result) => {
if (error)
throw error;
done();
});
});
it("EntitySet subscribes entities", () => {
var fable = new EdgeFable("../Fable.EdgeJS/bin/debug/Fable.EdgeJS.dll", "foo");
var entitySet = new EntitySet(fable, "foo");
entitySet.subscribe().then(() => {
assert(entitySet.entities.length === 2);
});
});
});
开发者ID:kedrzu,项目名称:asparagus,代码行数:36,代码来源:test.ts
示例3: test
var resultObjects = [];
var headers = [];
if (result.length > 1) {
headers = result[0];
for (var i = 1; i < result.length; i++) {
var tmp_obj = {};
for (var j = 0; j < headers.length; j++) {
tmp_obj[headers[j]] = result[i][j];
}
resultObjects.push(tmp_obj);
}
}
return resultObjects;
}
/* load oracle-query function from dll */
db.executeQuery = edge.func(require('path').join(__dirname, 'libs/oracle_node_net.dll'));
db.test = test;
db.prototype = null;
module.exports = db;
function test() {
var query = "SELECT e.SERIAL_NBR AS SERIAL, es.VENDOR_NAME AS MARCA, es.VENDOR_MODEL_NUMBER AS MODELO, d.WIFI FROM equip_ca_value ecav, equipment e, equipment_spec es, mss_int.reuso_eqcpe_detalle d WHERE ecav.EQUIPMENT_ID = e.EQUIPMENT_ID AND e.EQUIPMENT_SPEC_ID = es.EQUIPMENT_SPEC_ID AND es.VENDOR_NAME = d.MARCA AND es.VENDOR_MODEL_NUMBER = d.MODELO AND es.EQUIPSPEC_TYPE = 'ATA' AND ecav.CA_VALUE_LABEL = 'Estado CPE' AND ecav.CA_VALUE = 'LIBRE' AND ROWNUM <= 3";
var query2 = "SELECT e.SERIAL_NBR AS SERIAL, es.VENDOR_NAME AS MARCA, es.VENDOR_MODEL_NUMBER AS MODELO, LISTAGG(CONCAT(CONCAT(ecav.CA_VALUE_LABEL,': '),ecav.CA_VALUE), ', ') WITHIN GROUP (ORDER BY ecav.CA_VALUE_LABEL) ATRIBUTOS FROM equip_ca_value ecav, equipment e, equipment_spec es, mss_int.reuso_eqcpe_detalle d WHERE ecav.EQUIPMENT_ID = e.EQUIPMENT_ID AND e.EQUIPMENT_SPEC_ID = es.EQUIPMENT_SPEC_ID AND es.VENDOR_NAME = d.MARCA AND es.VENDOR_MODEL_NUMBER = d.MODELO AND es.EQUIPSPEC_TYPE = 'MTA' AND (ecav.CA_VALUE_LABEL like '%MAC%' OR (ecav.CA_VALUE_LABEL = 'Estado CPE' AND ecav.CA_VALUE = 'LIBRE')) AND ROWNUM <= 5 GROUP BY e.SERIAL_NBR, es.VENDOR_NAME, es.VENDOR_MODEL_NUMBER";
var connectionString = 'SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.77.80)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=PREMSSDB)));uid = CHERNL; pwd = SQAMSSDB;';
/*var ExecuteQuery = edge.func('oracle_node_net.dll');
ExecuteQuery({
connectionString: 'SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.77.80)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=PREMSSDB)));uid = CHERNL; pwd = SQAMSSDB;',
command: query2
}, function(error, result) {
if (error) throw error;
console.log(result);
开发者ID:clystian,项目名称:oracle-querier,代码行数:31,代码来源:index.ts
示例4: SimpleSignalOutput
var convertImage = edge.func(function() {/*
#r "RedRat.dll"
#r "System.Xml.dll"
#r "System.IO.dll"
#r "System.Xml.Serialization.dll"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RedRat.RedRat3;
using RedRat.RedRat3.USB;
using System.Threading.Tasks;
using RedRat.AVDeviceMngmt;
using System.Xml.Serialization;
using System.Xml;
using System.IO;
using RedRat.Util;
using RedRat.IR;
public class Startup
{
public async Task<object> Invoke(object input)
{
await Task.Run(async () => {
SimpleSignalOutput();
});
return 0;
}
public void SimpleSignalOutput()
{
try
{
string[] TestArgs = {"AVDeviceDB.xml", "Humax", "Program+"};
//CheckArgs(TestArgs);
using (var rr3 = FindRedRat3())
{
var signalDB = LoadSignalDB(TestArgs[0]);
var signal = GetSignal(signalDB, TestArgs[1], TestArgs[2]);
rr3.OutputModulatedSignal(signal);
Console.WriteLine("Signal {0}->{1} output.\n", TestArgs[1], TestArgs[2]);
}
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
}
/// <summary>
/// Simple check of program arguments. We need all three in the correct order to work.
/// </summary>
///
//private void CheckArgs(string[] args)
//{
// Need all three arguments.
// if ((args != null) && (args.Length == 3)) return;
// throw new Exception("Invalid argument list.\n\nUsage: SimpleSignalOutput database-file.xml device-name signal-name\n");
//}
/// <summary>
/// Simply finds the first RedRat3 attached to this computer.
/// </summary>
public IRedRat3 FindRedRat3()
{
var rr3li = RRUtil.FindRedRats(RRUtil.RedRatTypes.REDRAT3).FirstOrDefault();
if (rr3li == null)
{
throw new Exception("Unable to find any RedRat3 devices on this computer.");
}
return rr3li.GetRedRat() as IRedRat3; ;
}
/// <summary>
/// Loads the signal database XML file.
/// </summary>
public AVDeviceDB LoadSignalDB(string dbFileName)
{
var ser = new XmlSerializer(typeof(AVDeviceDB));
var fs = new FileStream((new FileInfo(dbFileName)).FullName, FileMode.Open);
var avDeviceDB = (AVDeviceDB)ser.Deserialize(fs);
return avDeviceDB;
}
/// <summary>
/// Returns an IR signal object from the signal DB file using the deviceName and signalName to
/// look it up.
/// </summary>
public IRPacket GetSignal(AVDeviceDB signalDB, string deviceName, string signalName)
{
var device = signalDB.GetAVDevice(deviceName);
if (device == null)
{
throw new Exception(
//.........这里部分代码省略.........
开发者ID:ksoh,项目名称:redrat,代码行数:101,代码来源:redrat.ts
示例5: commit
*/
public commit(): void {
return functions({ fn: 'commitTransaction', transaction: this.transaction }, true);
}
/**
* Rolls back the transaction and closes the database connection.
*/
public cancel(): void {
return functions({ fn: 'cancelTransaction', transaction: this.transaction }, true);
}
}
//#region Edge Function Inits
var functions = edge.func({
source: __dirname + "/.cs/Sql.cs",
typeName: 'aps_sql_cs.Sql',
methodName: 'Invoke',
references: ['System.dll', 'System.Data.dll']
});
//#endregion
}
exports.connectionString = aps.connectionString;
exports.executeQuery = aps.executeQuery;
exports.executeNonQuery = aps.executeNonQuery;
exports.beginTransaction = aps.beginTransaction;
开发者ID:camMCC,项目名称:aps-sql,代码行数:31,代码来源:sql.ts
示例6: require
ďťżconsole.log("Person in Node Console");
// TypeScript implementation
import people = require("../Person/Person");
var person = new people.Person.TypeScript.Person(
new Date(1970, 1, 1), "Joe Smith");
console.log("TypeScript Person: " + person.toString());
// Edge implementation
var edge = require("edge");
var personProxy = edge.func({
assemblyFile: "People.NET.dll",
typeName: "People.NET.PersonProxy",
methodName: "GetAsync"
});
var personProxyInput = {
birthDate: new Date(1980, 2, 2),
name: "Jane Smith"
};
personProxy(personProxyInput, (error, result) => {
console.log("Edge.js Person: " + result.Name + ", " + result.BirthDate.Year);
});
console.log("Press return to exit.");
// FYI: https://nodejsmodules.org/tags/prompt
process.stdin.resume();
process.stdin.on("data", chunk => process.exit());
开发者ID:JasonBock,项目名称:NodeForNETDevelopers,代码行数:31,代码来源:app.ts
注:本文中的edge.func函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论