Hello JohnGeeB,
Patching ClearScript may not be necessary. Consider this code:
With this setup, all exposed .NET objects that implement
Good luck!
Patching ClearScript may not be necessary. Consider this code:
engine.Script.host = new HostFunctions(); engine.AddHostType(typeof(IEnumerable)); engine.Execute(@" host.constructor.prototype[Symbol.iterator] = function () { var enumerable = host.asType(IEnumerable, this); if (host.isNull(enumerable)) throw new TypeError('the host object is not enumerable'); var enumerator = enumerable.GetEnumerator(); return { next: function () { if (enumerator.MoveNext()) return { done: false, value: enumerator.Current }; return { done: true }; } }; } ");
IEnumerable
support the ES6 iteration protocols.Good luck!