-
Notifications
You must be signed in to change notification settings - Fork 263
Javascript API
Cristi Burcă edited this page Apr 1, 2015
·
7 revisions
P2P uses the Backbone framework to organize its JavaScript code, so you should get familiar with it before going further.
The model classes and model collections are exposed via the window.P2PAdmin property. Views are not exposed.
Source code: https://github.com/scribu/wp-posts-to-posts/blob/master/admin/box.js
Manually trigger a refresh of the connection candidates for a given metabox:
P2PAdmin.boxes['YOUR_CONNECTION_TYPE'].candidates.sync()Delete all the connections for a particular connection type (for the current post):
P2PAdmin.boxes['YOUR_CONNECTION_TYPE'].connections.clear()