Skip to content

Commit 00818f4

Browse files
authored
Merge pull request #3 from nciske/patch-1
Copy edits
2 parents 5cabc34 + 1c9be36 commit 00818f4

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,33 @@
22

33
## Introduction
44

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.
66

77
## Goals
88

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.
1111

1212
## 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.
1414

1515
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.
1616

1717
* https://github.com/beezwax/FMAjax
1818
* https://blog.beezwax.net/2015/09/18/fmajax-and-filemaker-web-viewers/
1919

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 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.
2121

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.
2323

24+
One example is our GoDraw application:
2425
https://www.geistinteractive.com/products/filemaker-drawing-tool-godraw/
2526

2627
## Limits
2728

2829
* 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.
3132
* FileMaker 16 and later only.
3233

3334
## Installation
@@ -45,17 +46,17 @@ import * as fm from 'fm-webviewer-bridge'
4546
fm.callFMScript(file, script, data)
4647
```
4748

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.
4950

5051
### With a script tag
5152

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:
5354

5455
```
5556
<script src='https://unpkg.com/fm-webviewer-bridge/dist/fm-webviewer-bridge.umd.js'></script>
5657
```
5758

58-
then later use the `fm` object in other scripts
59+
Then later use the `fm` object in other scripts:
5960

6061
```
6162
<script>
@@ -66,9 +67,9 @@ fm.callFMScript(file, script, data);
6667

6768
## How it works
6869

69-
### JavaScript Side
70+
### Javascript Side
7071

71-
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
7273

7374
```
7475
<script>
@@ -121,10 +122,11 @@ You call "Load WebViewer..." first. When that script is done you can safely assu
121122

122123
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
123124

124-
### Execute JavaScript On A WebViewer
125+
### Execute Javascript on a WebViewer
125126

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.
127128

129+
Here is an example:
128130
```json
129131
{
130132
"function" : "hello",
@@ -137,7 +139,7 @@ Calling JavaScript on a webViewer amounts to describing the name of the function
137139
}
138140
```
139141

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.
141143

142144
## Example
143145

0 commit comments

Comments
 (0)