如何通过Chrome扩展程序后台页面打开新标签页?

时间:2016-04-09 22:59:11

标签: javascript google-chrome

我正在使用从class Order { /** * @var Address * * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Address") * @ORM\JoinColumn(onDelete="CASCADE", nullable=false) * * @Assert\NotBlank() * @Assert\Valid() */ private $invoiceAddress; /** * @var Address * * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Address") * @ORM\JoinColumn(onDelete="SET NULL", nullable=true) * * @Assert\Valid() */ private $deliveryAddress; public function getInvoiceAddress() { return $this->invoiceAddress; } public function setInvoiceAddress(Address $address) { $this->invoiceAddress = $address; } public function getDeliveryAddress() { return $this->deliveryAddress; } public function setDeliveryAddress(Address $address = null) { $this->deliveryAddress = $address; } } 到后台页面使用let MyUrl = NSURL(fileURLWithPath: "*** Custom File Path ***") let fileAttributes = try! NSFileManager.defaultManager().attributesOfItemAtPath(MyUrl.path!) let fileSizeNumber = fileAttributes[NSFileSize] as! NSNumber let fileSize = fileSizeNumber.longLongValue var sizeMB = Double(fileSize / 1024) sizeMB = Double(sizeMB / 1024) print(String(format: "%.2f", sizeMB) + " MB") 的Chrome扩展程序,当private class humidControl implements Runnable { public void run() { try { screen.setField(String.valueOf(calc.getHumid()), 21); Thread.sleep(1000*humidTime); while(on == true) { calc.changeHumid(); screen.setField(String.valueOf(calc.getHumid()), 21); if(calc.getHumidifier()) screen.setField("Humidifier is on", 24); else if (!calc.getHumidifier()); screen.setField("Humidifier is off", 24); Thread.sleep(1000*humidTime); } } catch (InterruptedException e) { return; } } } private class AmbientHumid implements Runnable { public void run() { try { while(on == true) { calc.ambientHumid(); screen.setField(String.valueOf(calc.getHumid()), 21); Thread.sleep(1000*AhumidTime); } } catch (InterruptedException e) { return; } } } 收到邮件时,它应该打开一个新的标签页一个URL。消息发送OK,但新选项卡永远不会打开。那么如何从后台页面在用户的浏览器上打开它呢?

background.js:

sendMessage

0 个答案:

没有答案