Skip to content

Commit

Permalink
refactor: remove overcomplicated JS
Browse files Browse the repository at this point in the history
  • Loading branch information
hypebright committed Mar 14, 2024
1 parent b50aed0 commit 1d8f4c5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 32 deletions.
2 changes: 1 addition & 1 deletion inst/shinyMobile-1.0.1/dist/shinyMobile.min.css.map

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions inst/shinyMobile-1.0.1/dist/shinyMobile.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions inst/shinyMobile-1.0.1/dist/shinyMobile.min.js.map

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions srcjs/bindings/sliderInputBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { getAppInstance } from "../init.js";
var f7SliderBinding = new Shiny.InputBinding();

$.extend(f7SliderBinding, {
app: null,

initialize: function(el) {

Expand Down Expand Up @@ -47,19 +46,16 @@ $.extend(f7SliderBinding, {

// Given the DOM element for the input, return the value
getValue: function(el) {
this.app = getAppInstance();
return this.app.range.getValue($(el)[0]);
},

// see updateF7Slider
setValue: function(el, value) {
this.app = getAppInstance();
this.app.range.setValue($(el)[0], value);
},

// see updateF7Slider
receiveMessage: function(el, data) {
this.app = getAppInstance();
// create a variable to update the range
var r = this.app.range.get(el.id);
if (data.hasOwnProperty('min')) {
Expand Down
7 changes: 0 additions & 7 deletions srcjs/bindings/stepperInputBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { getAppInstance } from "../init.js";
var f7StepperBinding = new Shiny.InputBinding();

$.extend(f7StepperBinding, {
app: null,

initialize: function(el) {

Expand Down Expand Up @@ -51,31 +50,26 @@ $.extend(f7StepperBinding, {

// Given the DOM element for the input, return the value
getValue: function(el) {
this.app = getAppInstance();
return this.app.stepper.getValue($(el)[0]);
},

// see updateF7Stepper
setValue: function(el, value) {
this.app = getAppInstance();
this.app.stepper.setValue(el, value);
},

// the 2 methods below are needed by incrementF7Stepper
// and decrementF7Stepper
increment: function() {
this.app = getAppInstance();
this.app.stepper.increment();
},

decrement: function() {
this.app = getAppInstance();
this.app.stepper.decrement();
},

// see updateF7Stepper
receiveMessage: function(el, data) {
this.app = getAppInstance();
// create a variable to update the stepper
var s = this.app.stepper.get($(el));

Expand Down Expand Up @@ -174,7 +168,6 @@ $.extend(f7StepperBinding, {

subscribe: function(el, callback) {
$(el).on('stepper:change.f7StepperBinding', function(e) {
this.app = getAppInstance();
// no need to debounce here
// except if autorepeat is set
// then we send the value once
Expand Down
3 changes: 0 additions & 3 deletions srcjs/bindings/virtualListBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { getAppInstance } from "../init.js";
var f7VirtualListBinding = new Shiny.InputBinding();

$.extend(f7VirtualListBinding, {
app: null,

// decode html so that images tag are converted to strings
decodeHTML: function(html) {
Expand Down Expand Up @@ -119,7 +118,6 @@ $.extend(f7VirtualListBinding, {

// Given the DOM element for the input, return the value
getValue: function(el) {
this.app = getAppInstance();
var vl = this.app.virtualList.get($(el)[0]);
return {
length: vl.items.length,
Expand All @@ -131,7 +129,6 @@ $.extend(f7VirtualListBinding, {

// see updateF7VirtualList
setValue: function(el, value) {
this.app = getAppInstance();
var vl = this.app.virtualList.get($(el)[0]);
vl.resetFilter();

Expand Down

0 comments on commit 1d8f4c5

Please sign in to comment.