Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Observable } from "@nativescript/core/data/observable";
var vm = new Observable();
export function onPageLoaded(args) {
var page = args.object;
vm.set("firstTitle", "fiiiirst");
vm.set("secondTitle", "secondTitle");
vm.set("secondIcon", "res://icon");
page.bindingContext = vm;
}
var i = 0;
export function onTap() {
i++;
vm.set("firstTitle", "changed " + i);
if (i === 3) {
vm.set("firstIcon", "res://ic_action");
}
beforeEach("create handlers", () => {
handler = function() {
callCount++;
}
observable = new Observable();
observable.once("test", handler);
});
afterEach("reset handlers", () => {
function ensureStateListener() {
if (accessibilityStateChangeListener) {
return sharedA11YObservable;
}
const a11yManager = getA11YManager();
sharedA11YObservable = new Observable() as SharedA11YObservable;
Object.defineProperty(sharedA11YObservable, AccessibilityServiceEnabledPropName, {
get(this: SharedA11YObservable) {
return this[A11yStateEnabledPropName] && this[TouchExplorationStateEnabledPropName];
},
});
if (!a11yManager) {
sharedA11YObservable.set(A11yStateEnabledPropName, false);
sharedA11YObservable.set(TouchExplorationStateEnabledPropName, false);
return sharedA11YObservable;
}
accessibilityStateChangeListener = new AccessibilityStateChangeListener({
onAccessibilityStateChanged(enabled) {
sharedA11YObservable.set(A11yStateEnabledPropName, !!enabled);
function ensureStateListener() {
if (sharedA11YObservable) {
return sharedA11YObservable;
}
sharedA11YObservable = new Observable() as SharedA11YObservable;
sharedA11YObservable.set(AccessibilityServiceEnabledPropName, isAccessibilityServiceEnabled());
if (typeof UIAccessibilityVoiceOverStatusDidChangeNotification !== 'undefined') {
nativeObserver = nsApp.ios.addNotificationObserver(UIAccessibilityVoiceOverStatusDidChangeNotification, () =>
sharedA11YObservable.set(AccessibilityServiceEnabledPropName, isAccessibilityServiceEnabled()),
);
nsApp.on(nsApp.exitEvent, () => {
if (nativeObserver) {
nsApp.ios.removeNotificationObserver(nativeObserver, UIAccessibilityVoiceOverStatusDidChangeNotification);
}
nativeObserver = null;
sharedA11YObservable = null;
});
function ensureObservable() {
if (internalObservable) {
return;
}
internalObservable = new Observable();
setupConfigListener();
}
function ensureObservable() {
if (internalObservable) {
return;
}
internalObservable = new Observable();
setupConfigListener();
}