Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
ionic-swiper
Advanced tools
An angular wrapper for swiper focused on ionic v1 as an 'swipe' lib (not slide)
If you're looking for an angular wrapper for swiper you can find it here.
My version of angular swiper is focused on ionic v1, since ionic v1 lists does'nt support swipes for both sides i wrote this 'simple' wrappers for Swiper (which seems to be the one used in ionic 2) to support this.
An demo is available here and on the demo folder
You just need to import the swiper.bundle.js
in the HTML like this:
<link type="text/css" href="swiper.css"/>
<script type="text/javascript" src="swiper.bundle.js"></script>
<script type="text/javascript">
angular.module('yourModule',['swiper.angular']);
</script>
Or if you use webpack you can use like this:
import {moduleName as angularSwiperModule} from 'angularSwiper/src/swiper.module';
angular.module('yourModule',[angularSwiperModule]);
//and import the .css your module generates in your html.
You can import the module like that, but you'll need to use these two in your webpack:
You can override the default configurations for swiper with
SwiperConfigurationsProvider
on the config phase
like the shown on below:
config.$inject = ['SwiperConfigurationsProvider'];
function config(SwiperConfigurationsProvider) {
'use strict';
SwiperConfigurationsProvider.useAsDefaultConfigs({
resistanceRatio: 0.3
})
}
Please note that for now, you should not override the beforeDestroy event, since its used to detect when to remove swiper instances from the provided services.
The swiper service manages swiper instances, below is a list of exposed functions:
Exposed Function | Description |
---|---|
SwiperService.getInstances() | returns all registered swiper instances. |
SwiperService.getSwiperDefaultConfig(extend) | returns the default swiper configurations (including ones set in config phase) |
SwiperService.isInMove() | if the user is moving the swiper container (this is useful for make a on hold select using onHold ionic directive) |
SwiperService.createInstance(containerId, $element) | creates a swiper instances using default configs and keeping track of the instance, you probably should not use this, it should only be used by the module controllers. |
The swiper selection service manages a swipe synchronization between selection of swiper containers.
Exposed Function | Description |
---|---|
SwiperSelectionService.get() | returns all the current selection synchronized swiper instances |
SwiperSelectionService.clear() | removes all the selected instances controllers and clears the selected list |
SwiperSelectionService.putInSelection(containerId) | Put the id associated swiper instance in the selection list and sincronizes the swipe |
SwiperSelectionService.removeFromSelection(containerId) | Removes the id associated swiper instance from selection and remove swipe synchronization |
SwiperSelectionService.toggleToSelection(containerId) | Uses internally putInSelection and removeFromSelection , checking if the provided id is in selection list |
Most of the swiper management is done by using an id, this id is exposed by swiperContainer
directive
used example:
<div
swiper-container="true"
class="swiper-container"
ng-repeat="item in ctrl.items">
<!-- containerId is available inside this context -->
<div class="swiper-wrapper">
<ion-item swiper-slide="center">
This swiper container id is {{:: containerId }}
</ion-item>
<ion-item class="side-item" swiper-slide="right">
Right Button
</ion-item>
<ion-item class="side-item" swiper-slide="left">
Left Button
</ion-item>
</div>
</div>
My implementation seems to not work properly with ionic's collection-repeat
,
it works partially, but for some items swiper seems to get a 'free swipe mode'.
There are some problems with ionic list scroll on browser mode, it seems that swiper take the 'drag'/scroll event to itself.
yarn install
should setup everything to dev env.
then you can run npm start
and start the development
To make the dist build, you should run npm build
, if every test pass,
then you can use the dist bundle.
I'm using Ramda to get a better functional approach.
Swiper is a SLIDE lib, so there are some limitations in this lib..
FAQs
An angular wrapper for swiper focused on ionic v1 as an 'swipe' lib (not slide)
The npm package ionic-swiper receives a total of 28 weekly downloads. As such, ionic-swiper popularity was classified as not popular.
We found that ionic-swiper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.