The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.
Send messages to iframe using iframeEl.contentWindow.postMessage
Recieve messages using window.addEventListener('message')
; We have other reflective functions (words-of, body-of, etc.), but | |
; this is a little higher level, sounded fun to do, and may prove | |
; useful as we write more Red tools. It also shows how to make your | |
; own typesets and use them when parsing. | |
arity-of: function [ | |
"Returns the fixed-part arity of a function spec" | |
spec [any-function! block!] | |
/with refs [refinement! block!] "Count one or more refinements, and add their arity" | |
][ |
Red [ | |
Author: "Toomas Vooglaid" | |
Date: "2017-05-07" | |
Changed: "2018-07-09" | |
Purpose: "Print a directory tree" | |
File: "%dir-tree.red" | |
] | |
context [ | |
; Some helpers | |
get-char: func [hex][to-char to-integer hex] |
Red [ | |
title: "Red Object Browser" | |
author: "Gregg Irwin" | |
needs: 'View | |
] | |
e.g.: :comment | |
map-ex: func [ | |
"Evaluates a function for all values in a series and returns the results." |
Red [ | |
Title: "generator function experiments" | |
Author: "Dave Andersen" | |
Date: 27-Sep-2017 | |
] | |
reload: does [do system/options/script] | |
; @JacobGood's closure func | |
closure1: func [ |
Red [ | |
Title: "Parse Info" | |
Purpose: { | |
Provides some stats about internal parse states usage for a given parsing job. | |
Could be used as a way to compare efficiency of different parsing strategies. | |
} | |
Date: 06-Oct-2017 | |
] | |
context [ |
Red [] | |
e.g.: :comment | |
delta-time: function [ | |
"Return the time it takes to evaluate a block" | |
code [block! word! function!] "Code to evaluate" | |
/count ct "Eval the code this many times, rather than once" | |
][ | |
ct: any [ct 1] |
Red [ | |
Needs: View | |
Author: "Toomas Vooglaid" | |
Date: 2018-01-12 | |
Purpose: {To study conversions between datatypes} | |
] | |
ctx: context [ | |
types: compose [ | |
hex #00000001 | |
local-file "file.red" |
Red [] | |
e.g.: :comment | |
; ideally not exported on the global context | |
delta-time*: function [code count] [ | |
start: now/precise | |
loop count code | |
difference now/precise start | |
] |
Red [ | |
Author: "Toomas Vooglaid" | |
Date: 2018-08-10 | |
Last: 2018-08-11 | |
Purpose: {Attempt at multi-selection text-list style} | |
] | |
cnt: 0 | |
view [ | |
style multi-selection-text-list: text-list | |
on-create [face/extra: object [key: none selected: none selection: copy [] nums: copy [] layer: none]] |