add firefox extension template
This commit is contained in:
9
externs/webextension_polyfill/urlbar/EngagementState.hx
Normal file
9
externs/webextension_polyfill/urlbar/EngagementState.hx
Normal file
@@ -0,0 +1,9 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
The state of an engagement made with the urlbar by the user. <code>start</code>: The user has started an engagement.
|
||||
<code>engagement</code>: The user has completed an engagement by picking a result. <code>abandonment</code>
|
||||
: The user has abandoned their engagement, for example by blurring the urlbar. <code>discard</code>
|
||||
: The engagement ended in a way that should be ignored by listeners.
|
||||
**/
|
||||
typedef EngagementState = String;
|
@@ -0,0 +1,19 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
Before a query starts, this event is fired for the given provider. Its purpose is to request the provider's behavior for
|
||||
the query. The listener should return a behavior in response. By default, providers are inactive,
|
||||
so if your provider should always be inactive, you don't need to listen for this event.
|
||||
**/
|
||||
typedef OnBehaviorRequestedEvent = {
|
||||
/**
|
||||
Registers an event listener <em>callback</em> to an event.
|
||||
**/
|
||||
function addListener(callback:(query:Query) -> OnBehaviorRequestedReturnEnum, providerName:String):Void;
|
||||
/**
|
||||
Deregisters an event listener <em>callback</em> from an event.
|
||||
**/
|
||||
function removeListener(callback:(query:Query) -> OnBehaviorRequestedReturnEnum):Void;
|
||||
function hasListener(callback:(query:Query) -> OnBehaviorRequestedReturnEnum):Bool;
|
||||
function hasListeners():Bool;
|
||||
};
|
@@ -0,0 +1,6 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
The behavior of the provider for the query.
|
||||
**/
|
||||
typedef OnBehaviorRequestedReturnEnum = String;
|
17
externs/webextension_polyfill/urlbar/OnEngagementEvent.hx
Normal file
17
externs/webextension_polyfill/urlbar/OnEngagementEvent.hx
Normal file
@@ -0,0 +1,17 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
This event is fired when the user starts and ends an engagement with the urlbar.
|
||||
**/
|
||||
typedef OnEngagementEvent = {
|
||||
/**
|
||||
Registers an event listener <em>callback</em> to an event.
|
||||
**/
|
||||
function addListener(callback:(state:EngagementState) -> Void, providerName:String):Void;
|
||||
/**
|
||||
Deregisters an event listener <em>callback</em> from an event.
|
||||
**/
|
||||
function removeListener(callback:(state:EngagementState) -> Void):Void;
|
||||
function hasListener(callback:(state:EngagementState) -> Void):Bool;
|
||||
function hasListeners():Bool;
|
||||
};
|
18
externs/webextension_polyfill/urlbar/OnQueryCanceledEvent.hx
Normal file
18
externs/webextension_polyfill/urlbar/OnQueryCanceledEvent.hx
Normal file
@@ -0,0 +1,18 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
This event is fired for the given provider when a query is canceled. The listener should stop any ongoing fetch or
|
||||
creation of results and clean up its resources.
|
||||
**/
|
||||
typedef OnQueryCanceledEvent = {
|
||||
/**
|
||||
Registers an event listener <em>callback</em> to an event.
|
||||
**/
|
||||
function addListener(callback:(query:Query) -> Void, providerName:String):Void;
|
||||
/**
|
||||
Deregisters an event listener <em>callback</em> from an event.
|
||||
**/
|
||||
function removeListener(callback:(query:Query) -> Void):Void;
|
||||
function hasListener(callback:(query:Query) -> Void):Bool;
|
||||
function hasListeners():Bool;
|
||||
};
|
20
externs/webextension_polyfill/urlbar/OnResultPickedEvent.hx
Normal file
20
externs/webextension_polyfill/urlbar/OnResultPickedEvent.hx
Normal file
@@ -0,0 +1,20 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
Typically, a provider includes a <code>url</code> property in its results' payloads.
|
||||
When the user picks a result with a URL, Firefox automatically loads the URL. URLs don't make sense for every result
|
||||
type, however. When the user picks a result without a URL, this event is fired. The provider should take an appropriate
|
||||
action in response. Currently the only applicable <code>ResultTypes</code> are <code>dynamic</code> and <code>tip</code>.
|
||||
**/
|
||||
typedef OnResultPickedEvent = {
|
||||
/**
|
||||
Registers an event listener <em>callback</em> to an event.
|
||||
**/
|
||||
function addListener(callback:(payload:OnResultPickedPayloadType, elementName:String) -> Void, providerName:String):Void;
|
||||
/**
|
||||
Deregisters an event listener <em>callback</em> from an event.
|
||||
**/
|
||||
function removeListener(callback:(payload:OnResultPickedPayloadType, elementName:String) -> Void):Void;
|
||||
function hasListener(callback:(payload:OnResultPickedPayloadType, elementName:String) -> Void):Bool;
|
||||
function hasListeners():Bool;
|
||||
};
|
@@ -0,0 +1,6 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
The payload of the result that was picked.
|
||||
**/
|
||||
typedef OnResultPickedPayloadType = { };
|
@@ -0,0 +1,19 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
When a query starts, this event is fired for the given provider if the provider is active for the query and there are no
|
||||
other providers that are restricting. Its purpose is to request the provider's results for the query.
|
||||
The listener should return a list of results in response.
|
||||
**/
|
||||
typedef OnResultsRequestedEvent = {
|
||||
/**
|
||||
Registers an event listener <em>callback</em> to an event.
|
||||
**/
|
||||
function addListener(callback:(query:Query) -> Array<Result>, providerName:String):Void;
|
||||
/**
|
||||
Deregisters an event listener <em>callback</em> from an event.
|
||||
**/
|
||||
function removeListener(callback:(query:Query) -> Array<Result>):Void;
|
||||
function hasListener(callback:(query:Query) -> Array<Result>):Bool;
|
||||
function hasListeners():Bool;
|
||||
};
|
23
externs/webextension_polyfill/urlbar/Query.hx
Normal file
23
externs/webextension_polyfill/urlbar/Query.hx
Normal file
@@ -0,0 +1,23 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
A query performed in the urlbar.
|
||||
**/
|
||||
typedef Query = {
|
||||
/**
|
||||
Whether the query's browser context is private.
|
||||
**/
|
||||
var isPrivate : Bool;
|
||||
/**
|
||||
The maximum number of results shown to the user.
|
||||
**/
|
||||
var maxResults : Float;
|
||||
/**
|
||||
The query's search string.
|
||||
**/
|
||||
var searchString : String;
|
||||
/**
|
||||
List of acceptable source types to return.
|
||||
**/
|
||||
var sources : Array<SourceType>;
|
||||
};
|
25
externs/webextension_polyfill/urlbar/Result.hx
Normal file
25
externs/webextension_polyfill/urlbar/Result.hx
Normal file
@@ -0,0 +1,25 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
A result of a query. Queries can have many results. Each result is created by a provider.
|
||||
**/
|
||||
typedef Result = {
|
||||
/**
|
||||
An object with arbitrary properties depending on the result's type.
|
||||
**/
|
||||
var payload : ResultPayloadType;
|
||||
/**
|
||||
The result's source.
|
||||
**/
|
||||
var source : SourceType;
|
||||
/**
|
||||
The result's type.
|
||||
**/
|
||||
var type : ResultType;
|
||||
/**
|
||||
Suggest a preferred position for this result within the result set.
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var suggestedIndex : Float;
|
||||
};
|
@@ -0,0 +1,6 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
An object with arbitrary properties depending on the result's type.
|
||||
**/
|
||||
typedef ResultPayloadType = { };
|
9
externs/webextension_polyfill/urlbar/ResultType.hx
Normal file
9
externs/webextension_polyfill/urlbar/ResultType.hx
Normal file
@@ -0,0 +1,9 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
Possible types of results. <code>dynamic</code>: A result whose view and payload are specified by the extension. <code>
|
||||
remote_tab</code>: A synced tab from another device. <code>search</code>: A search suggestion from a search engine.
|
||||
<code>tab</code>: An open tab in the browser. <code>tip</code>: An actionable message to help the user with their query.
|
||||
<code>url</code>: A URL that's not one of the other types.
|
||||
**/
|
||||
typedef ResultType = String;
|
13
externs/webextension_polyfill/urlbar/SearchOptions.hx
Normal file
13
externs/webextension_polyfill/urlbar/SearchOptions.hx
Normal file
@@ -0,0 +1,13 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
Options to the <code>search</code> function.
|
||||
**/
|
||||
typedef SearchOptions = {
|
||||
/**
|
||||
Whether to focus the input field and select its contents.
|
||||
Optional.
|
||||
**/
|
||||
@:optional
|
||||
var focus : Bool;
|
||||
};
|
10
externs/webextension_polyfill/urlbar/SourceType.hx
Normal file
10
externs/webextension_polyfill/urlbar/SourceType.hx
Normal file
@@ -0,0 +1,10 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
/**
|
||||
Possible sources of results. <code>bookmarks</code>: The result comes from the user's bookmarks. <code>history</code>
|
||||
: The result comes from the user's history. <code>local</code>: The result comes from some local source not covered by
|
||||
another source type. <code>network</code>: The result comes from some network source not covered by another source type.
|
||||
<code>search</code>: The result comes from a search engine. <code>tabs</code>: The result is an open tab in the browser
|
||||
or a synced tab from another device.
|
||||
**/
|
||||
typedef SourceType = String;
|
48
externs/webextension_polyfill/urlbar/Static.hx
Normal file
48
externs/webextension_polyfill/urlbar/Static.hx
Normal file
@@ -0,0 +1,48 @@
|
||||
package webextension_polyfill.urlbar;
|
||||
|
||||
typedef Static = {
|
||||
/**
|
||||
Closes the urlbar view in the current window.
|
||||
**/
|
||||
function closeView():Void;
|
||||
/**
|
||||
Focuses the urlbar in the current window.
|
||||
**/
|
||||
function focus(?select:Bool):Void;
|
||||
/**
|
||||
Starts a search in the urlbar in the current window.
|
||||
**/
|
||||
function search(searchString:String, ?options:SearchOptions):Void;
|
||||
/**
|
||||
Before a query starts, this event is fired for the given provider. Its purpose is to request the provider's behavior for
|
||||
the query. The listener should return a behavior in response. By default, providers are inactive,
|
||||
so if your provider should always be inactive, you don't need to listen for this event.
|
||||
**/
|
||||
var onBehaviorRequested : OnBehaviorRequestedEvent;
|
||||
/**
|
||||
This event is fired when the user starts and ends an engagement with the urlbar.
|
||||
**/
|
||||
var onEngagement : OnEngagementEvent;
|
||||
/**
|
||||
This event is fired for the given provider when a query is canceled. The listener should stop any ongoing fetch or
|
||||
creation of results and clean up its resources.
|
||||
**/
|
||||
var onQueryCanceled : OnQueryCanceledEvent;
|
||||
/**
|
||||
When a query starts, this event is fired for the given provider if the provider is active for the query and there are no
|
||||
other providers that are restricting. Its purpose is to request the provider's results for the query.
|
||||
The listener should return a list of results in response.
|
||||
**/
|
||||
var onResultsRequested : OnResultsRequestedEvent;
|
||||
/**
|
||||
Typically, a provider includes a <code>url</code> property in its results' payloads.
|
||||
When the user picks a result with a URL, Firefox automatically loads the URL. URLs don't make sense for every result
|
||||
type, however. When the user picks a result without a URL, this event is fired. The provider should take an appropriate
|
||||
action in response. Currently the only applicable <code>ResultTypes</code> are <code>dynamic</code> and <code>tip</code>.
|
||||
**/
|
||||
var onResultPicked : OnResultPickedEvent;
|
||||
/**
|
||||
Enables or disables the engagement telemetry.
|
||||
**/
|
||||
var engagementTelemetry : webextension_polyfill.types.Setting;
|
||||
};
|
Reference in New Issue
Block a user