Winsoft JSEngine 2.4
Winsoft JSEngine 2.4
jР°vascript engine for Delphi.
uses Microsoft ChakraCore jР°vascript engine
supports Windows 32 and Windows 64
available for Delphi 6 - 10.2 and Lazarus 1.6.4
source code included in registered version
distributing library in applications is royalty free
Examples
// block
{
const a = 1 // block-scoped constant
let b = 2 // block-scoped variable
}
// template literals
function complexToString(a, b) {
return `${a} + ${b}i`
}
complexToString(1, 2)
// multi-line strings
let html = `
Hello
`
// destructing assignment
const [a, , c] = [1, 2, 3, 4]
const {a, c} = {a: 1, b: 2, c: 3, d: 4}
// class
class Person {
constructor(name) {
this.name = name
}
hello() {
return 'Hello, ' + this.name + '!'
}
}
const erik = new Person('Erik')
erik.name
erik.hello()
// inheritance
class Student extends Person {
hello() {
return 'Hello, student ' + this.name + '!'
}
}
const patrik = new Student('Patrik')
patrik.hello()
// arrow functions
[1, 2, 3].map(value => value + 1)
const increment = value => value + 1
increment(1)
// for of
let sum = 0
for (const element of [1, 2, 3])
sum += element
// default parameters
function hello(name = 'Erik') {
return 'Hello, ' + name + '!'
}
// rest parameters
function restParams(first, ...rest) {
return rest
}
// spread operator
Math.max(1, 2, 3)
Math.max(...[1, 2, 3])
const a = [1, 2, 3]
const b = [4, 5, 6]
const c = [...a, ...b]
ECMAScript 2016 examples
2 ** 3 // exponentiation operator
{
const a = 1 // block-scoped constant
let b = 2 // block-scoped variable
}
// template literals
function complexToString(a, b) {
return `${a} + ${b}i`
}
complexToString(1, 2)
// multi-line strings
let html = `
Hello
// destructing assignment
const [a, , c] = [1, 2, 3, 4]
const {a, c} = {a: 1, b: 2, c: 3, d: 4}
// class
class Person {
constructor(name) {
this.name = name
}
hello() {
return 'Hello, ' + this.name + '!'
}
}
const erik = new Person('Erik')
erik.name
erik.hello()
// inheritance
class Student extends Person {
hello() {
return 'Hello, student ' + this.name + '!'
}
}
const patrik = new Student('Patrik')
patrik.hello()
// arrow functions
[1, 2, 3].map(value => value + 1)
const increment = value => value + 1
increment(1)
// for of
let sum = 0
for (const element of [1, 2, 3])
sum += element
// default parameters
function hello(name = 'Erik') {
return 'Hello, ' + name + '!'
}
// rest parameters
function restParams(first, ...rest) {
return rest
}
// spread operator
Math.max(1, 2, 3)
Math.max(...[1, 2, 3])
const a = [1, 2, 3]
const b = [4, 5, 6]
const c = [...a, ...b]
ECMAScript 2016 examples
2 ** 3 // exponentiation operator
Only for V.I.P
Warning! You are not allowed to view this text.