You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-16Lines changed: 18 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,32 +2,33 @@
2
2
3
3
## Introduction
4
4
5
-
This library creates a Bridge between the FileMaker WebViewer and the HTML/JS?CSS App running inside it. It enables two way communication between FileMaker and the App running in the web viewer.
5
+
This library creates a Bridge between the FileMaker WebViewer and the HTML/JS/CSS application running inside it. It enables two way communication between FileMaker and the web application running in the web viewer.
6
6
7
7
## Goals
8
8
9
-
1.make it possible to call JavaScript functions in a web viewer via FileMaker scripts, WITHOUT causing the web viewer to refresh each time.
10
-
1. Allow JavaScript apps to call FileMaker Scripts using the fmp url, with huge amounts of data as the script parameter
9
+
1.Make it possible to call Javascript functions in a web viewer via FileMaker scripts, WITHOUT causing the web viewer to refresh each time.
10
+
1. Allow Javascript apps to call FileMaker Scripts using the fmp url, with huge amounts of data as the script parameter.
11
11
12
12
## Credits and History
13
-
The techniques used in this module are not new. Some of them date back almost 10 years. I presented at DevCon on this topic back when 8.5 shipped. The techniques have changed over the years as Internet explorer improved. I am not sure who first discovered using onHashChange or using an a tag to call an fmp script. I am pretty sure that Jason Young at Seedcode was the first one to use the clipboard as a way to get around the URL length limit.
13
+
The techniques used in this module are not new -- some of them date back almost 10 years. I presented at DevCon on this topic back when 8.5 shipped. The techniques have changed over the years as Internet Explorer has improved. I am not sure who first discovered using `onHashChange` or using an `<a>` tag to call an fmp script. I am pretty sure that Jason Young at Seedcode was the first one to use the clipboard as a way to get around the URL length limit.
14
14
15
15
Beezwax has also done lots of stuff in this area. Their fmAJAX project and blog posts about it are good source material and informed some of the decisions I made when building this module.
What is new here is the abstraction and the API. It is an attempt to make an API that is easy to understand for JS devs and for FileMaker Devs. It is also an attempt to imagine what an API might look like if it ever made it's way into FileMaker's web viewer, natively.
20
+
What is new here is the abstraction and the API. It is an attempt to make an API that is easy to understand for Javascript devs and for FileMaker devs. It is also an attempt to imagine what an API might look like if it ever made it's way into FileMaker's web viewer, natively.
21
21
22
-
I believe this to be about the right level of abstraction based on what we can do today. It is a single file you can include in your JS app, and a couple of scripts you add to your FileMaker system. Individuall applications can build on top of this abstraction to handle almost any situation you come accross. We have built massive JS applications, that pass megabytes of data back and forth with out difficulty. One example is our GoDraw application.
22
+
I believe this to be about the right level of abstraction based on what we can do today. It is a single file you can include in your Javascript app, and a couple of scripts you add to your FileMaker system. Individual applications can build on top of this abstraction to handle almost any situation you come accross. We have built massive Javascript applications, that pass megabytes of data back and forth, without difficulty.
* You can't call a FileMaker Script from a web viewer running in FileMaker WebDirect.
29
-
* It uses the clipboard on windows, and therefor may interfere with clipboard contents.
30
-
* Doesn't work with a data URL. It must be a real URL. It can be to a server somewhere or a locally exported file
30
+
* It uses the clipboard on Windows, and therefore may interfere with clipboard contents.
31
+
* Doesn't work with a data URL -- it must be a real URL. It can be to a server somewhere or a locally exported file.
31
32
* FileMaker 16 and later only.
32
33
33
34
## Installation
@@ -45,17 +46,17 @@ import * as fm from 'fm-webviewer-bridge'
45
46
fm.callFMScript(file, script, data)
46
47
```
47
48
48
-
NOTE: if you are going to use ES6 you'll need to transpile your code to ES5 if you want it to work with Windows. You can do this with either babel.js or buble.js
49
+
NOTE: If you are going to use ES6 you'll need to transpile your code to ES5 if you want it to work with Windows. You can do this with either babel.js or buble.js.
49
50
50
51
### With a script tag
51
52
52
-
Include the umd version of the script in the header of your page. The file is in the 'dist' folder. Or You can load it straight from the unpkg.com CDN like so.
53
+
Include the umd version of the script in the header of your page (the file is in the 'dist' folder) or you can load it straight from the unpkg.com CDN like so:
the `fm` object has a some methods on it that let you expose specific JavaScript functions to FileMaker scripts and call back to FileMaker scripts. Here is how you would expose a function called hello to FileMaker Scripts
72
+
the `fm` object has a some methods on it that let you expose specific Javascript functions to FileMaker scripts and call back to FileMaker scripts. Here is how you would expose a function called `hello` to FileMaker Scripts
72
73
73
74
```
74
75
<script>
@@ -121,10 +122,11 @@ You call "Load WebViewer..." first. When that script is done you can safely assu
121
122
122
123
The properties of that JSON Parameter tell what URL to load on what WebViewer. And also provide a way to load a bunch of JSON into the app on startup through the `intialProps` parameter. Anything passed there will be available on `fm.initialProps` in your JavaScript application
123
124
124
-
### Execute JavaScript On A WebViewer
125
+
### Execute Javascript on a WebViewer
125
126
126
-
Calling JavaScript on a webViewer amounts to describing the name of the function you want to call and the parameters to call it with as part of a JSON Object. Here is an example.
127
+
Calling Javascript on a webViewer amounts to describing the name of the function you want to call and the parameters to call it with as part of a JSON Object.
127
128
129
+
Here is an example:
128
130
```json
129
131
{
130
132
"function" : "hello",
@@ -137,7 +139,7 @@ Calling JavaScript on a webViewer amounts to describing the name of the function
137
139
}
138
140
```
139
141
140
-
Passing that JSON to "Execute JavaScript..." script will attempt to call a JavaSCript function exposed as "hello", with the parameter `{"who": "Todd"}`, and it will call the script "Handle CallBack FileMaker Script" in the file "Contacts.fmp12" with the results of the function.
142
+
Passing that JSON to "Execute JavaScript..." script will attempt to call a JavaSCript function exposed as `hello`, with the parameter `{"who": "Todd"}`, and it will call the script "Handle CallBack FileMaker Script" in the file "Contacts.fmp12" with the results of the function.
0 commit comments