Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c52eff4

Browse files
Add JSScheduler and JSPromise publisher (#1)
`JSScheduler` is copied from TokamakUI/Tokamak#281. You can see the `JSPromise` publisher in action in combination with `fetch` by running `carton dev` in the root directory. I saw some issues with `JSValueDecoder`, which is why it's not used in this PR. I will investigate `JSValueDecoder` issues separately. * Add `JSScheduler` and `JSPromise` publisher * Clean up publisher signature in `main.swift` * Capture `self` weakly in `PromisePublisher.init`
1 parent 6bcfd07 commit c52eff4

File tree

14 files changed

+519
-0
lines changed

14 files changed

+519
-0
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
linux_build:
11+
runs-on: ubuntu-20.04
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: swiftwasm/swiftwasm-action@master
16+
with:
17+
shell-action: swift build --triple wasm32-unknown-wasi

‎.github/workflows/label.yml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Check PR labels
2+
3+
# Controls when the action will run. Triggers the workflow on push or pull request
4+
# events but only for the `main` branch
5+
on:
6+
pull_request:
7+
branches: [main]
8+
types: [opened, synchronize, reopened, labeled, unlabeled]
9+
10+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
11+
jobs:
12+
check-labels:
13+
# The type of runner that the job will run on
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Match PR Label
18+
uses: zwaldowski/match-label-action@v2
19+
with:
20+
allowed_multiple: >
21+
API design,
22+
bug,
23+
continuous integration,
24+
dependencies,
25+
documentation,
26+
enhancement,
27+
refactor,
28+
test suite,

‎.pre-commit-config.yaml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v2.5.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- id: detect-private-key
12+
- id: check-merge-conflict
13+
- repo: https://github.com/hodovani/pre-commit-swift
14+
rev: master
15+
hooks:
16+
- id: swift-lint
17+
- id: swift-format

‎.swiftformat‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--indent 2
2+
--indentcase false
3+
--trimwhitespace always
4+
--voidtype tuple
5+
--nospaceoperators ..<,...
6+
--ifdef noindent
7+
--stripunusedargs closure-only
8+
--maxwidth 100
9+
--wraparguments before-first
10+
--funcattributes prev-line
11+
--disable andOperator
12+
--swiftversion 5.3

‎.swiftlint.yml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
disabled_rules:
2+
- trailing_comma
3+
- identifier_name
4+
- void_return
5+
- operator_whitespace
6+
- nesting
7+
- cyclomatic_complexity
8+
- multiple_closures_with_trailing_closure
9+
- type_name
10+
- opening_brace
11+
12+
line_length: 100
13+
14+
function_body_length:
15+
- 50
16+
17+
included:
18+
- Sources
19+
- Tests

‎.vscode/settings.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"editor.tabSize": 2,
3+
"editor.formatOnSave": true,
4+
"licenser.author": "OpenCombineJS contributors"
5+
}

‎.vscode/tasks.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "carton dev",
8+
"type": "shell",
9+
"command": "carton dev"
10+
}
11+
]
12+
}

‎Package.resolved‎

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Package.swift‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// swift-tools-version:5.3
2+
import PackageDescription
3+
let package = Package(
4+
name: "OpenCombineJS",
5+
products: [
6+
.executable(name: "OpenCombineJSExample", targets: ["OpenCombineJSExample"]),
7+
.library(name: "OpenCombineJS", targets: ["OpenCombineJS"]),
8+
],
9+
dependencies: [
10+
.package(
11+
name: "JavaScriptKit",
12+
url: "https://github.com/swiftwasm/JavaScriptKit.git",
13+
from: "0.7.2"
14+
),
15+
.package(
16+
name: "OpenCombine",
17+
url: "https://github.com/MaxDesiatov/OpenCombine.git",
18+
from: "0.0.1"
19+
),
20+
],
21+
targets: [
22+
.target(
23+
name: "OpenCombineJSExample",
24+
dependencies: [
25+
"OpenCombineJS",
26+
]
27+
),
28+
.target(
29+
name: "OpenCombineJS",
30+
dependencies: [
31+
"JavaScriptKit", "OpenCombine",
32+
]
33+
),
34+
]
35+
)

‎Sources/OpenCombineJS/JSError.swift‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2020 OpenCombineJS contributors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import JavaScriptKit
16+
17+
extension JSError: JSValueConstructible {
18+
public static func construct(from value: JSValue) -> JSError? {
19+
guard let object = value.object else { return nil }
20+
return JSError(unsafelyWrapping: object)
21+
}
22+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /