npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

landscape-simulator

v0.0.3

Published

Simulate landscape in scenes that cannot be landscaped

Downloads

6

Readme

LandscapeSimulator

Online Use | 中文 | Changelog | Issue | Gitee

1. Features

  1. Typescript writing
  2. Support mobile vertical screen rotation to simulate horizontal screen
  3. Get the simulated landscape state and length and width

2. Quick use

1.1 npm way

npm i landscape-simulator
import LandscapeSimulator from 'landscape-simulator';

LandscapeSimulator.init({
  disablePc: false, // default is true
})

It is recommended to place the above initialization code in the head for execution

1.2 cdn

When using the cdn method, the script tag can be placed in the head

<script auto-simulate='true' src="https://cdn.jsdelivr.net/npm/landscape-simulator/landscape-simulator.min.js"></script>

You can use the property auto-simulate=true to control to use auto-on simulation, the default is false

You can use the attribute disable-pc=false to control the simulation to be enabled on the pc side. The default is not to enable it on the pc side.

When referenced by cdn, the LandscapeSimulator object will be mounted on the window

2 APIs

2.1 init

Initialize the simulator, which will be automatically initialized when referenced by cdn

const isSimulated = await LandscapeSimulator.init({
  disablePc: false, // default is true
});

2.2 appendChild

Add child elements to a rotating container

LandscapeSimulator.appendChild(htmlElement);

2.3 getSimulateSize

Get the emulated later screen size

const size = LandscapeSimulator.getSimulateSize();

2.4 isSimulateLandscape

Get whether it is currently in a state of simulating a landscape screen

const bool = LandscapeSimulator.isSimulateLandscape();

2.5 onSimulateChange

Listen for changes in the state of the simulated horizontal screen

LandscapeSimulator.onSimulateChange(isSimulate => {
  
});

2.6 isEnabled

const bool = LandscapeSimulator.isEnabled()

2.7 getContainer

const container = LandscapeSimulator.getContainer()