TPS History Lists 编辑

There are two types of history asset lists, one used for adding/modiyfing/verifying history, and the other for deleting history.

The history list used for operations other than delete has the following properties:

  • uri: required.
  • title: optional. The page title for this uri.
  • visits: required. An array of objects representing visits to the page, each object has the following properties:
    • type: required. An integer value from one of the transition types listed at /wiki/en/nsINavHistoryService#Constants.
    • date: required. An integer representing when the visit took place, expressed in hours from the present. For example, 0 is now, -24 is 24 hours in the past.

For example:

var history_initial = [
  { uri: "http://www.google.com/",
    title: "Google",
    visits: [
      { type: 1, date: 0 },
      { type: 2, date: -1 }
    ]
  },
  { uri: "http://www.cnn.com/",
    title: "CNN",
    visits: [
      { type: 1, date: -1 },
      { type: 2, date: -36 }
    ]
  },
];

The history list used for deletions looks different. It's an array of objects, each of which represents a type of history to delete. There are three different types:

  • to delete all references to a specific page from history, use an object with a uri property
  • to delete all references to all pages from a specific host, use an object with a host property
  • to delete all history in a certain time period, use an object with begin and end properties, which should have integer values that express time since the present in hours (see date above)

For example:

var history_to_delete = [
  { uri: "http://www.cnn.com/" },
  { begin: -24,
    end: -1 },
  { host: "www.google.com" }
];

History lists and phase actions

History lists cannot be modified, they can only be added, deleted, and verified, using the following functions:

  • History.add
  • History.delete
  • History.verify
  • History.verifyNot

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:36 次

字数:2622

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文