本文整理匯總了TypeScript中meteor/meteor.Meteor.connect方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Meteor.connect方法的具體用法?TypeScript Meteor.connect怎麽用?TypeScript Meteor.connect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類meteor/meteor.Meteor
的用法示例。
在下文中一共展示了Meteor.connect方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: reconnect
reconnect() {
let server = ConnectServiceMeteor._getServerURL();
let display = server.result + (server.fromMeteor ? ' (url calculated by meteor)' : ' (url from config)');
console.info('Reconnecting: ' + display + ' Meteor.status(): ' + JSON.stringify(Meteor.status()));
Meteor.connect(server.result);
Meteor.reconnect();
}
示例2: setServerTo
setServerTo(app_url) {
console.log('setting url' + app_url)
Meteor.connection = Meteor.connect(app_url);
_.each(['subscribe', 'methods', 'call', 'apply', 'status','reconnect','disconnect'], function (name) {
Meteor[name] = _.bind(Meteor.connection[name], Meteor.connection);
});
Package.reload = false;
Accounts.connection = Meteor.connection;
}
示例3:
export let generateData = Promise.denodeify((cb) => {
const testConnection = Meteor.connect(Meteor.absoluteUrl());
testConnection.call('tasks', cb);
});
示例4: Promise
export let generateData = () => new Promise((resolve) => {
const testConnection = Meteor.connect(Meteor.absoluteUrl());
testConnection.call('tasks', () => resolve());
});