JavaScript double colon (bind operator)
No. The bind operator (spec proposal) comes in two flavours:
Method extraction
::obj.method ≡ obj.method.bind(obj)
"virtual method" calls
obj::function ≡ function.bind(obj)
obj::function(…) ≡ function.call(obj, …)
Neither of them feature partial application. For what you want, you should use an arrow function:
(...args) => this.handleStuff('stuff', ...args) ≡ this.handleStuff.bind(this, 'stuff')
What does :: (double colon) mean in JavaScript?
The ::
is a proposed binding operator that desugars into a bound function:
::foo.bar
// becomes
foo.bar.bind(foo)
This is useful in React (and any other event handlers) because it means this
will have the expected value (instance of the class) when the event handler is later invoked.
JavaScript double colon (bind operator)
No. The bind operator (spec proposal) comes in two flavours:
Method extraction
::obj.method ≡ obj.method.bind(obj)
"virtual method" calls
obj::function ≡ function.bind(obj)
obj::function(…) ≡ function.call(obj, …)
Neither of them feature partial application. For what you want, you should use an arrow function:
(...args) => this.handleStuff('stuff', ...args) ≡ this.handleStuff.bind(this, 'stuff')
What does ‘::’ (double colon) do in JavaScript?
Nothing. It is a syntax error.
>>> alert(42342::37438)
SyntaxError: missing ) after argument list
What does ‘::’ (double colon) do in javascript for events?
I've been able to find an obscure reference in some scanned manual from Microsoft Office Infopath 2003. It appears to be a JScript
syntax:
a double colon is used as separator
between the script ID and the event
name
My guess is that's not part (or no longer part) of Internet explorer's ECMAScript implementation but it belongs (or used to belong) to Microsoft Office's implementation.
Babel is unable to parse double colon despite there being a babel config present
The Babel docs say that to use it, you need to:
(1) Install the plugin:
npm install --save-dev @babel/plugin-proposal-function-bind
(2) Add it to your Babel config:
{
"plugins": ["@babel/plugin-proposal-function-bind"]
}
Or, you could go back to the old syntax without using Babel at all:
this.on('client:beforeCommand', (...args) => this.onBeforeCommand(...args));
What does two colons inside an angular expression {{::}} mean?
The {{::office.name}}
syntax is Angular's One-Time binding, available since version 1.3
Here's a nice blog explaining it.
Double colons in function declaration in Javascript?
Thanks for everyone who looked into this.
Anyway, just as one could expect, not after five minutes after submitting the question, I found How to handle an ActiveX event in Javascript question about ActiveX callback handlers in IE, so it answers the main part of the question. As well, as the question that @outis has linked.
But I can't find any documentation on MSDN and that's troubling.
Conclusion: this is IE-specific ECMAScript extension for event handler declaration.
Related Topics
Capture Browser Console Logs with Capybara
How Is a JavaScript String Not an Object
Wkwebview - Complex Communication Between JavaScript & Native Code
Creating a "Sticky" Fixed-Position Item That Works on iOS Safari
Dt: Link Binding Is Lost After Re-Rendering the Table
Fire Greasemonkey Script on Ajax Request
Time Conversion Between Ruby on Rails and JavaScript Vice Versa
What's the Difference Between Console.Dir and Console.Log
Slow Assets Compilation in Development Mode
Sorting Arrays Numerically by Object Property Value
Using Enter Key with Action Button in R Shiny
Passing Array of Objects from Js to Rails
What Is the "Best" Way to Get and Set a Single Cookie Value Using JavaScript
How to Print an Iframe from JavaScript in Safari/Chrome
Shiny App:Disable Downloadbutton