Mac Developer Library

Developer

WebKit Framework Reference WebPlugIn Protocol Reference

Options
Deployment Target:

On This Page
Language:

WebPlugIn

The WebPlugIn informal protocol defines methods that enable interaction between an application using the WebKit framework and any WebKit-based plug-ins it may use.

  • Returns an object that exposes the plug-in’s scripting interface.

    Declaration

    Swift

    var objectForWebScript: AnyObject! { get }

    Objective-C

    @property(nonatomic, readonly, strong) id objectForWebScript

    Return Value

    An object representing the plug-in’s scripting interface.

    Discussion

    The methods of the object are exposed to the script environment. Messages sent to the returned object will be invoked in the scripting environment. See the WebScripting Protocol Reference informal protocol for more details.

    Availability

    Available in OS X v10.3.9 and later.

  • Controls plug-in behavior based on its selection.

    Declaration

    Swift

    func webPlugInSetIsSelected(_ isSelected: Bool)

    Objective-C

    - (void)webPlugInSetIsSelected:(BOOL)isSelected

    Parameters

    isSelected

    If YEStrue, the plug-in is currently selected. Otherwise, it is not selected.

    Discussion

    This may be used, for example, to change the plug-in’s appearance when it is selected by the user.

    Availability

    Available in OS X v10.3.9 and later.

  • Prepares the plug-in for deallocation.

    Declaration

    Swift

    func webPlugInDestroy()

    Objective-C

    - (void)webPlugInDestroy

    Discussion

    Typically, this method frees the memory and other resources used by the plug-in. For example, if the plug-in had a copy of a WebPlugInContainer object, this method should relinquish ownership of that object. Do not send any other messages to the plug-in after invoking this method, because calling this method destroys the plug-in. No other methods in this interface may be called after the application has called this method.

    Availability

    Available in OS X v10.3.9 and later.

  • Initializes the plug-in.

    Declaration

    Swift

    func webPlugInInitialize()

    Objective-C

    - (void)webPlugInInitialize

    Discussion

    Tells the plug-in to perform one-time initialization. This method must be called only once per instance of the plug-in object, before any other methods in the protocol are called.

    Availability

    Available in OS X v10.3.9 and later.

  • Tells the plug-in to start normal operation.

    Declaration

    Swift

    func webPlugInStart()

    Objective-C

    - (void)webPlugInStart

    Discussion

    The plug-in usually begins its primary task (such as drawing, playing sounds, or animating) in this method. This method may be called more than once, provided that the application has already called webPlugInInitialize and that each call to this method is followed later by a call to webPlugInStop.

    Availability

    Available in OS X v10.3.9 and later.

  • Tells the plug-in to stop normal operation.

    Declaration

    Swift

    func webPlugInStop()

    Objective-C

    - (void)webPlugInStop

    Discussion

    This method may be called more than once, provided that the application has already called webPlugInInitialize and that each call to this method is preceded by a call to webPlugInStart.

    Availability

    Available in OS X v10.3.9 and later.