I'm not exactly clear on what you want to do in WIG. Could you please show an example of what you have in JavaScript and what would you like to write in WIG?

Also you can mix WIG with plain F# types across assemblies. So if you need a type in WIG that you can't express well with its language, you can write that in a separate library project and reference that from the WIG project. This also works the other way around. If you need a WIG generated type you can make a new library project, reference the WIG one (the generated assembly will be referenced) and you can use your WIG generated types.

By on 11/13/2015 9:57 AM ()

I discovered the "Configuration Class" after I wrote the question. It may solve my current issue.

However I did run into a similar issue before. For example, your code here: http://www.websharper.com/question/77724/working-with-clipboardevent?tag=extension

The paste event is different per browser, IE and FF, see the "doPaste" function here: https://github.com/fjoppe/WebsharperDataGrid/blob/master/DataGrid/Client.fs

I would like to combine both in one assembly. So you do a neccesary basic mapping with WIG, and add some convenience functionality with normal fsharp code. In one assembly.

By on 11/13/2015 12:25 PM ()

You can't do it in one assembly unfortunately. You can do basically two things if you don't want a new assembly:

  • use With*Inline to express browser specific behavior, like (haven't tested this code nor do I know the exact interface of ClipboardEvent):
1
2
3
4
5
Class "ClipboardEvent"
|+> Instance [
	"clipboardData" =? ClipboardData
    |> WithGetterInline "$this ? $this.clipboardData : window.clipboardData"
]
  • Alternatively if you have more complicated cross-browser logic you can write that as a small JavaScript code and use bind the appropriate functions against that with WithInline transformators.
By on 11/13/2015 1:50 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper