PayPal Checkout.js functions data vs actions variables? - paypal

I am trying to add PayPal button using checkout.js and a lot of examples need a function with such declaration:
function (data, actions) {
// ...
}
Doing some debugging, I found that data and actions variables have exactly the same properties on them. This is kinda weird and the question I am left is, what are the purposes of these two? Cause they sound to be very different.
That's some excerpt of my findings, deeper properties are also the same:

Related

Attachments are not updated asynchronously in Fiori MyInbox app?

I use SAP standard library: Inbox.
in library class S3.controller by tap on attachments icon is onTabSelect event executed, witch makes
this.fnDelegateAttachmentsCreation();
this.fnFetchDataOnTabSelect("Attachments");
this.fnHandleAttachmentsCountText("Attachments");
this.fnHandleNoTextCreation("Attachments");
break;
fnFetchDataOnTabSelect makes an asynchronous call. During this call is fnHandleAttachmentsCountText already executed, so the update of attachments count occurs before the request for attachments is ready. As far the request for attachments is ready, there is no update for title executed.
On screenshot is AttachmentCountText „Attachnents (1/1)“, that comes from previously selected item.
It should be „Attachements (2/2)".
Also if response comes too quick, then view changes to loading view after it received the answer from request.
If list of attachments was updated from request callback, then it should not be updated second time.
Here it seems, that there is something on loading, but request is already finished.
How could be Inbox extended, to update the attachment header and content after request is ready?
used SAPUI5-Version: 1.71.4
You are using the standard bsp-application ca_fiori_inbox?
You didn't create an extension project of the application ca_fiori_inbox with custom coding?
If that's the case, it's a bug in an standard application delivered by the SAP. SAP releases so called notes to fix bugs in their standard applications.
You can import notes in your system via the transaction SNOTE. May ask a SAP Basis Administrator from your company for help.
The following notes exactly describe your problem
2873960
2823664
2916255
2901520
If you already extended the SAP standard application(MyInbox) without using ExtensionPoints codechanges in the standard application will not affect your custom extension.
When overriding a controller method, any functionality that was previously provided by it is no longer available. Likewise, any future changes made to the original controller method implementation will not be reflected in the custom controller.
In this case you could still implement the note and check the changes in the standard controller vs. your custom controller on your system and change the respective lines in your custom coding.
Don't fix SAP coding. Report it and get a fix.
The Note 2873960 corrects coding in an abap class, not in the bsp-application(ca_fiori_inbox). So definitly import the note and check if it's fixing your problem.
I actually do not know, how the app works, but I want to give it a try.
Since it is an asynchronous function, you can always also wait for the function until it is done. So in your case, you could try to set an await keyword in front of the function.
await fnFetchDataOnTabSelect("Attachments");
This will now wait on this position until it has finished the function call before it will call the next functions. In addition to that you also need to set the upper function onTabSelect to async. So in the end it should look something like this.
onTabSelect: async function() {
// ...
this.fnDelegateAttachmentsCreation();
await this.fnFetchDataOnTabSelect("Attachments");
this.fnHandleAttachmentsCountText("Attachments");
this.fnHandleNoTextCreation("Attachments");
// ...
}
Although the Web IDE maybe shows you errors, it does work, since it is an official JavaScript API.

Calling a Unity WebGl Function from JavaScript (Vue)

I have a VueJs Project right now, where I'm building a web page. In order to show 3D Content and let the User work with it, I wanted to embed a Unity Project as WebGL. I´m not a professional programmer, my knowledge is more selfe-taught from what I can find at the Internet.
First of all I created a plugin, as it is explained here. My .jslib file looks like that:
var UnityJavascipt = {
$JustAWebGLObject:
{
},
SendToJavscript: function ()
{
console.log("worked!")
}
}; autoAddDeps(UnityJavascipt , '$JustAWebGLObject'); mergeInto(LibraryManager.library, UnityJavascipt );
I embed my Unity WebGl like that in Vue:
<template>
<unity src="static/Build/game.json" width="1000" height="600" unityLoader="static/Build/UnityLoader.js" ref="myInstance"></unity>
</template>
I can also call "SendToJavaScript" from my C# Script. But now it starts to get unclear for me, since I want to be able to call my "SendToJavaScript" Function (or any other one that will be added later) from a outside JavaScript. In the manual they refer to the emscripten pagefor more detailed information. But for me that all is just very confusing. I already tried to call my function like that in VueJs:
_SendToJavaScript()
But I always get a ReferenceError: _SendToJavaScript is not defined I also read in the forum here, that it would be possible to call the function like that:
UnityInstance.Module.asmLibraryArg._SendToJavaScript()
UnityInstance is the Variable from my index.html file, where UnityLoader get's instantiated. But again I'm getting a Reference Error.
It would be very helpful if someone could explain what I'm doing wrong... Communication between WebGL and Vue are essential for my project but I´m stuck here for days. So thanks in advance!!
Use unityInstance.SendMessage() documented here.
You can pass a callback or call a .jslib defined function at the end of your C# method.

point-of-sale-api iOS callback from FileMaker Go

I'm close to getting my homegrown POS app to work with Square, but I'm missing something simple and can't seem to turn up an answer. I'm using FileMaker Go as the app, but I don't think that that is relevant to my current proof-of-concept issue. It may be relevant to other issues later (callbacks).
In my point-of-sale-api settings, I have:
com.filemaker.go.17
for the Bundle ID, and
create-workflow
for the iOS App URL Schemes, which seems to be the first piece of code that Square allows me to save. Any prefixed item such as shortcuts://create-workflow gives an error without description (I'm hoping that Square will trigger a workflow as a test in this POC).
I'm hoping to just trigger safari or workflow/shortcuts with the callback as filemaker go doesn't directly accept the callback response without a helper application - which I'll eventually try.
Any thoughts on what I'm missing?
Thanks tons!

Event Listeners Chrome Dev Tools - extend jQuery - why do even listeners point to library instead of customized/extended script?

Beginner / Intermediate developer here and trying to get a grasp on tracking down event listeners, but finding myself confused and frustrated because it always point to the library that handles the event, not the user's script. Example from the Event Listeners accordion on a select element that has the "keyup" event bound:
keyup
div.select
handler: function (e){return typeof b===i||e&&b.event.triggered===e.typet:b.event.dispatch.apply(f.elem,arguments)}
isAttribute: false
lineNumber: 3
listenerBody: "function (e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)}"
node: div.select
sourceName: "https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"
type: "keyup"
useCapture: false
Obviously they are using jQuery, and they're doing a damn good job of it by using jQuery's $.extend method, but I still don't understand why the events accordion (in dev tools) would point to the library rather than the customized script?
Is there something really basic I missed in class? What methods are there for tracking these types of things down aside from CTRL+F in the Resources tab, which, btw did not yield any search results for "select" in the file that ACTUALLY extends/adds this listener - very odd is it not?
Update: So I feel pretty dumb about this, but the answer was right in front of my eyes - or so I think. At the top of their custom script they begin with,
define(["jquery"], function($) {
Could this be the beginning of the answer? Really what I'd like to understand is why the event would still trace back to the library when the event listener is bound within the above code,
$el.textHolder.click(function(e){
... do stuff ...
}
As far as I understand, this is because when jQuery binds an event, it doesn't bind it directly to your code, but instead to jQuery code that then dispatches the event to your code.
The Chrome devtools don't know (at this point, it seems to be in development) how jQuery binds the event, so only shows the first handler (jQuery).
The define call is part of the CommonJS Modules Standard I believe. See also RequireJS

How do you set up an Optimizely test for a single-page app?

I have a single-page web app that presents a multi-step photo management "wizard", split up across several discrete steps (photo upload, styling, annotation, publishing) via a tab strip. On switching steps I set the URL hash to #publishing-step (or whichever step was activated).
How do I set up Optimizely tests to run on the various discrete steps of the wizard?
The browser never leaves the page, so it only gets a single window.load event. Its DOM isn't getting scrapped or regenerated, but just switches what page elements are visible at any one time via display: none or block, so the part I am trying to figure out is really mostly about in what way I go about the Optimizely test setup itself - it's fine (and likely necessary) if all edits get applied at once.
This thing unfortunately has to work in IE9, so I can't use history.pushState to get pretty discrete urls for each step.
There's actually several ways you could go about doing this, and which option you choose will largely depend on what's easiest for you AND how you plan to analyze the data.
If you want to use Optimizely's analytics dashboard:
I would recommend creating one experiment which will activate a bunch of other experiments at different times. The activation experiment will be targeted to everyone and run immediately when they get to your wizard. The other experiments will be set up with manual activation and triggered by this experiment.
The activation experiment would have code like:
window.optimizely = window.optimizely || [];
function hashChanged() {
if(location.hash === 'publishing-step') {
window.optimizely.push(['activate', 0000000000]);
}
if(location.hash === 'checkout-step') {
window.optimizely.push(['activate', 1111111111]);
}
}
window.addEventListener('hashchange', hashChanged, false);
Or you could call window.optimizely.push(['activate', xxxxxxxxx]); directly from your site's code instead of creating an activation experiment and listening for hashchange.
If you want to use a 3rd party analytics tool like Google Analytics:
You could do this all in one experiment with code similar to above, but in each "if" section instead of activating an experiment, you could run your variation code that makes changes to the wizard and sends special tracking information to your analytics sweet for later reporting. You'll have to do your own statistical significance calculation for this method (as Optimizely's data won't be "clean"), but this method actually works out better usually if properly configured.
Alternatively you could use the method outlined above but still try to use the Optimizely analytics dashboard by creating custom events on your experiment and sending data to them using calls like window.optimizely.push(["trackEvent", "eventName"]);
This article may also be helpful to you.
You'll probably need to do this yourself, using Optimizely's JS API to trigger actions on their end and tell it what your users did: https://www.optimizely.com/docs/api