Add 'del' as alias for 'delete' in JavaScript API
'delete' is a keyword in JavaScript and can't be easily used as function name. E.g. invoking the Gerrit.delete function from RestApi by '$wnd.Gerrit.delete'(p, r) fails on execution with "$wnd.Gerrit.delete" is not a function Because of this at the moment plugins can't do delete calls via the RestApi class. Trying to write "'$wnd.Gerrit.delete'(p, r)" as $wnd.Gerrit.delete(p, r) or $wnd.Gerrit.'delete'(p, r) fails already during compilation. Adding 'del' as an alias allows use to simply invoke $wnd.Gerrit.del(p, r) Change-Id: Idced35f0e27d4a932a7e8d48b0e2b19187bb427c Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
parent
f484d7eb91
commit
fc998c4ccf
@ -25,13 +25,14 @@ The plugin instance is passed to the plugin's initialization function
|
||||
and provides a number of utility services to plugin authors.
|
||||
|
||||
[[self_delete]]
|
||||
=== self.delete()
|
||||
=== self.delete() / self.del()
|
||||
Issues a DELETE REST API request to the Gerrit server.
|
||||
|
||||
.Signature
|
||||
[source,javascript]
|
||||
----
|
||||
Gerrit.delete(url, callback)
|
||||
Gerrit.del(url, callback)
|
||||
----
|
||||
|
||||
* url: URL relative to the plugin's URL space. The JavaScript
|
||||
|
@ -125,6 +125,7 @@ public class ActionContext extends JavaScriptObject {
|
||||
post: function(i,b){@com.google.gerrit.client.api.ActionContext::post(Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;)(this._u,i,b)},
|
||||
put: function(i,b){@com.google.gerrit.client.api.ActionContext::put(Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;)(this._u,i,b)},
|
||||
'delete': function(b){@com.google.gerrit.client.api.ActionContext::delete(Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;)(this._u,b)},
|
||||
del: function(b){@com.google.gerrit.client.api.ActionContext::delete(Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;)(this._u,b)},
|
||||
};
|
||||
}-*/;
|
||||
|
||||
|
@ -99,6 +99,7 @@ public class ApiGlue {
|
||||
}
|
||||
},
|
||||
'delete': function(u,b){@com.google.gerrit.client.api.ActionContext::delete(Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;)(this._api(u),b)},
|
||||
del: function(u,b){@com.google.gerrit.client.api.ActionContext::delete(Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;)(this._api(u),b)},
|
||||
};
|
||||
}-*/;
|
||||
|
||||
|
@ -62,6 +62,7 @@ final class Plugin extends JavaScriptObject {
|
||||
post: function(u,i,b){@com.google.gerrit.client.api.ActionContext::post(Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;)(this._api(u),i,b)},
|
||||
put: function(u,i,b){@com.google.gerrit.client.api.ActionContext::put(Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;)(this._api(u),i,b)},
|
||||
'delete': function(u,b){@com.google.gerrit.client.api.ActionContext::delete(Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;)(this._api(u),b)},
|
||||
del: function(u,b){@com.google.gerrit.client.api.ActionContext::delete(Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;)(this._api(u),b)},
|
||||
|
||||
_loadedGwt: function(){@com.google.gerrit.client.api.PluginLoader::loaded()()},
|
||||
_api: function(u){return @com.google.gerrit.client.rpc.RestApi::new(Ljava/lang/String;)(this._url(u))},
|
||||
|
@ -160,7 +160,7 @@ public class RestApi {
|
||||
}
|
||||
|
||||
private native static void delete(String p, JavaScriptObject r)
|
||||
/*-{ '$wnd.Gerrit.delete'(p, r) }-*/;
|
||||
/*-{ $wnd.Gerrit.del(p, r) }-*/;
|
||||
|
||||
private native static <T extends JavaScriptObject>
|
||||
JavaScriptObject wrap(AsyncCallback<T> b) /*-{
|
||||
|
Loading…
Reference in New Issue
Block a user