• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

Experimental Devvit Web Views

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
The

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

team just announced a new experimental way to build WebView based apps for Reddit. Previously only static HTML/JS/CSS could be used. With this new version, it is possible to run server-side code through Node including spinning up an

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

server.

Disclaimer


This is an experimental way of creating web views

This is not a finalized method. The state of this feature is very likely to change. Experimentation and developer

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

is crucial to how the final implementation ends up.

Prerequisites


$ npm i -g devvit
$ devvit login
Getting Started

  • Fork/Clone the

    Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

    template.
  • Change name: in package.json and devvit.yaml
  • Change YOUR_SUBREDDIT_NAME in package.json
  • Run npm install in the cloned dir.
  • Check out the contents of src/ for a working example of how to structure your app.
What You Can and Can't Do With This


Your app runs on a read-only filesystem. User generated content or any kind of data storage must be done through

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

or exist in Local Storage / IndexedDB / etc.

Reddit imposes restrictions on external URL access. Being able to run an Express router means that we can provide our own REST API to a Devvit app. That's an excellent addition to the toolkit. For one, this allows you to mock an external API for develpment purposes while you wait for approval for the actual domain to be added to the fetchable list. It also allows custom permission handling for routes through middleware without needing an approved external server.

In my opinion this is will really improve the developer experience. There is just one caveat that may be resolved in the future. It is not possible to upgrade an HTTP connection into a Web Socket. Hopefully we do get this feature as it would make possible some advanced realtime user experiences. In the meantime, if you need realtime communication between clients that can be accomplished through

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

and

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

.

Testing Your App


$ npm run dev

This starts a playtest that connects your dev environment to your subreddit. Saving a file automatically uploads the changes allowing you to test your app live.

Commit Changes


When you are done playtesting you can push your changes to Reddit.


$ npm run upload

Apps

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

to be installed into a subreddit with more than 200 users whether public or not.

Time to Experiment


This was just released, I'm sure we'll be seeing a wave of interesting interactive content popping up on Reddit in the near future. The Devvit community are already porting games and all sorts of ideas into this framework. I'm about to get started on an idea of my own. Let me know if you're planning on trying this out or share your creations here in the comments!


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу