-
Notifications
You must be signed in to change notification settings - Fork 121
Note : Materialize JSNI conversion to JSInterop
kevzlou7979 edited this page Aug 11, 2016
·
8 revisions
If you use static context to your method you will get ```(TypeError) : Cannot read property 'material' of undefined ```
Javascript ```javascript $(".mydropdown").dropdown(); ``` JSInterop ```java @JsMethod public native JsMaterialElement dropdown(); ```Javascript
Materialize.toast("message", 3000, funct);JSInterop
JsMaterialElement.toast(msg, lifeMillis, className, () -> {
if(callback != null) {
callback.run();
}
});Javascript
function({
// some methods
});JSInterop
new Functions.Func() {
// Some methods
};Javascript
$(".collapsible").collapsible();JSInterop/b>
$(".collapsible").collapsible();Javascript
options = {
container: "body",
selectYears: true,
selectMonths: true,
format: "yyyy/mm/dd";
};JSInterop
@JsType(isNative = true, name = "Object", namespace = JsPackage.GLOBAL)
public class JsDatePickerOptions {
@JsProperty
public String container;
@JsProperty
public boolean selectYears;
@JsProperty
public boolean selectMonths;
@JsProperty
public String format;
}javascript
interact(target).draggable(options);JSInterop
@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public class JsDnd extends JQueryElement {
@JsMethod(namespace = JsPackage.GLOBAL)
public static native JsDnd interact(Element target);
@JsMethod
public native void draggable(JsDndOptions options);
}All source code for JSInterop integration to GMD is available and feel free to test it and submit PR.