将`meteor.method`类型绑定绑定到普通对象

时间:2015-12-08 17:19:40

标签: javascript meteor

这可能听起来很奇怪,但我有一堂课。当我创建类时,我想生成许多流星方法。

from selenium import webdriver
import selenium, time, os

profile = webdriver.FirefoxProfile()
profile.set_preference('startup.homepage_welcome_url.additional', "http://it.kntu.ac.ir/Dorsapax/signin.aspx")
profile.set_preference('browser.download.hide_plugins_without_extensions', False)
profile.set_preference('extensions.mozilla_cc@internetdownloadmanager.com.install-event-fired', False)
profile.set_preference('browser.startup.page', "1")
profile.set_preference("browser.download.folderList", "2")
profile.set_preference("browser.download.dir", os.getcwd())
profile.set_preference("browser.helperApps.neverAsk.openFile", "audio/mpeg")
profile.set_preference("browser.helperApps.neverAsk.saveTsoDisk", "audio/mpeg")

driver = webdriver.Firefox(profile)
driver.implicitly_wait(30)
driver.set_window_size(850, 650)

cap_audio = driver.find_element_by_id("imgAudioCaptcha").click()

driver.close()

我想把它暴露出来,好像它是一个流星方法。也就是说,在我的客户端,我可以做类似的事情:

Robot = class RobotServer extends RobotBase {
  // ... not terribly important
  // want to make this run as if it were a meteor method
  send(command) {
    if (Roles.userIsInRole(this.userId, 'operator', this._id)) {
      this._sockets.get('commands').write(`${command}\r`);
    }
  }
}

这可能在流星内吗?

0 个答案:

没有答案